Quick question about the command find.

Maxime Alarie malarie at processia.com
Fri Jun 4 13:21:10 UTC 2010


Good day,

 

I  want to erase files and directories that are older than 15 days..
the command I use is :   find $MyPath -type d -exec rm {} \;

 

Obviously rm wont erase  a non empty directory..  I tried using  rm -r
but I got errors..  

 

My question is, How can I recursively delete  directories using find
-exec rm  without having to  use 2 commands:  find  . -type f -mtime +15
-exec rm  THEN  find . -type d -exec rmdir

 

Cheers,

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100604/24b78ab4/attachment.html>


More information about the ubuntu-users mailing list