View Single Post
  #4   (View Single Post)  
Old 1st June 2008
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

Something like

cd /var/ftp (or wherever you keep the files)
/usr/bin/find ./ -type f -mtime +7 -exec rm -f '{}' +

-type f file
-mtime + 7 older than 7 days
-exec rm -f '{}' +
That + at the end was something I found while googling--I'm trying to remember its purpose. Ah, I think it was a way to avoid getting the error of filelist too long.

http://www.hccfl.edu/pollock/Unix/FindCmd.htm

WARNING: DANGER and all that stuff.

I would definitely test it with echo rm rather than just rm before putting it into action.
Reply With Quote