Thursday, February 21, 2008

Deleting Files over Certain Age

The command to delete files over a certain age is deceptivly easy in linux.

   find * -mtime +5 -exec rm {} \;

That finds all files over 5 minutes old in the current directory. This is quite usefull in a backup script run from cron.

No comments: