[colug-432] Script Help: deleting old files: find foo -type f -mtime +6 -exec rm {} \;

jep200404 jep200404 at columbus.rr.com
Mon Mar 8 23:33:02 EST 2010


Tom Hanlon wrote:

> Any advice on how to create a script that deletes files older than a  
> week ?

I think the classic solution is to use find, 
with a command that looks something like: 

   find foo -type f -mtime +6 -exec rm {} \;

I've not tested the above. You'll definitely need to experiment and 
read the man page for find. Also explore -mmin. 

Jim



More information about the colug-432 mailing list