Thread: files in /tmp
View Single Post

   
  #8 (permalink)  
Old 02-20-2008, 05:26 PM
Taylor, Grant
 
Posts: n/a
Default Re: files in /tmp

+Alan Hicks+ wrote:
> True, but the following should work (untested)
>
> # find /tmp/Roll/ -type f -atime +3 -exec rm {} \;
> # find /tmp/Roll/ -type d -exec rmdir {} \;
>
> Now any files that haven't been referenced in 3 days are deleted, and
> any empty directories will be nixed as well.


I might suggest the addition of the "-p" (parent) switch to rmdir so you can clean out a directory structure that only contains directories and no files.



Grant. . . .
Reply With Quote