I often let files sit around on servers that contain logs and other automatically updated information. I want to clean these up every once in a while. Linux, of course, offers a great way to do this.

find $directory_to_clean -mtime +$days_old -exec rm {} ;

This bash command will look in the $directory_to_clean location and delete all files that are $days_old old.

If you are paranoid about the command and want to try it out first, use this one:

find $directory_to_clean -mtime +$days_old -exec ls -l {} ;

That command will list all the files instead of delete them.