[ale] Recursive script help

Michael D. Hirsch mdhirsch at mail.com
Fri May 3 11:50:24 EDT 2002


Armsby John-G16665 writes:
 > If you want a command, would not:
 > 
 > rm -Rf *.extension 
 > 
 > be adequate assuming you are in the correct directory when you run it?

No!  The -R flag means that if a directory name matches *.extension,
the entire directory and all its contents are destroyed.  It will only
match names in the current directory; it does not match filenames
recursively.

Find is the command to search through directories.

--Michael

 > 
 > John
 > 
 > 
 > -----Original Message-----
 > From: Michael D. Hirsch [mailto:mdhirsch at mail.com]
 > Sent: Friday, May 03, 2002 10:23 AM
 > To: Gary MacKay
 > Cc: ale at ale.org
 > Subject: [ale] Recursive script help
 > 
 > 
 > Gary MacKay writes:
 >  > Is there a command that will delete all files, such as *.xyz or
 >  > whatever,  in the current directory and all subdirectories below it?
 >  > 
 >  > I can make a script with a "for" loop to get the current and one layer
 >  > down, but how do I keep going to _all_ subdirs of subdirs of...? Is
 >  > there a single command or is a script required?
 > 
 > find is your friend.  Something like this should work:
 > 
 > find . -name \*.xyz -exec rm \{\} \;
 > 
 > --Michael
 > 
 > ---
 > This message has been sent through the ALE general discussion list.
 > See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
 > sent to listmaster at ale dot org.
 > 
 > ---
 > This message has been sent through the ALE general discussion list.
 > See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
 > sent to listmaster at ale dot org.




---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list