Random Linux

Linux, video games and web hosting

If you need to remove files for a specific amount of days back, you can use

find /path/to/files* -mtime +5 -exec rm {} \;

Where +5 is the amount of days that you want to remove back from.  In this case, it will remove files that are 5 days old and older.  For an example, if we wanted to remove all files that were 3 days old and older that are in /home/chris/public_html, we would want to run this:

find /home/chris/public_html/* -mtime +3 -exec rm {} \;

January 6th, 2011

Posted In: General

Leave a Reply

Your email address will not be published. Required fields are marked *