If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Remove files

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-04-04, 13:21
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
Remove files

With the rm command how do I remove all the files I have with the .sav extension from the current folder and all the sub folders that come under the current folder. I would first like to list the files using ls and then remove it using rm.
What are the flags/options i need to provide with the ls and rm commands

Thanks
Reply With Quote
  #2 (permalink)  
Old 05-04-04, 23:33
saurav101 saurav101 is offline
Registered User
 
Join Date: Oct 2003
Posts: 19
files=`find ./ -name '*.sav' 2>/dev/null`
ls -l $files
rm -i $files

Let me know if this helps
Thanks
Saurav
Reply With Quote
  #3 (permalink)  
Old 05-05-04, 13:20
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
Thanks Saurav, I will try it right away and let you know
Reply With Quote
  #4 (permalink)  
Old 05-05-04, 14:17
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
Worked wonders !! Perfect and just what I needed. Thanks again
Reply With Quote
  #5 (permalink)  
Old 05-05-04, 15:38
saurav101 saurav101 is offline
Registered User
 
Join Date: Oct 2003
Posts: 19
Thanks for your gratitude saccskiz :-) ( Sorry for the addressing since don't know your real name ) . Let me know if you need any further help.

Regards
Saurav
Reply With Quote
  #6 (permalink)  
Old 05-07-04, 08:21
praveenpr praveenpr is offline
Registered User
 
Join Date: Jan 2004
Location: Singapore
Posts: 89
find ./ -name '*.sav' 2>/dev/null|xrgs rm
__________________
Thanks and Regards,

Praveen Pulikunnu
Reply With Quote
  #7 (permalink)  
Old 05-07-04, 14:35
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
Thanks. I will document this too
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On