[plug] rm of contents

John Clayton mageaere at hotmail.com
Mon Mar 17 12:22:23 WST 2003


>Hi All
>
>To some of you this will appear trivial, but, I can't seem to work it out.
>
>I have a directory structure that looks like:
>
>dir -->  file
>             file2
>             dir2 -->    file
>                             file2
>                             file3
>             file3
>
>Now my aim is to delete all the files in each directory but leave
>directories intact.
>Would like it to work irrelevant of how deep the structure is.

This is a solution that I worked out

#rm $(find test/ -type f)

rm removes the files that are expanded from the find command. find is 
locating all of the files that are ordinary files with the -type f argument. 
I tried it on cygwin and it worked and test was the top level of the 
directory tree that I set up to experiment with.

_________________________________________________________________
MSN Instant Messenger now available on Australian mobile phones. Go to  
http://ninemsn.com.au/mobilecentral/hotmail_messenger.asp



More information about the plug mailing list