Analytic

Monday, May 13, 2013

Delete files older X days or minutes

This command deletes all files /PATH/TO/FOLDER/YOUR_FILENAME_PATTERN
those older than 45 days:

find /PATH/TO/FOLDER/ -name YOUR_FILENAME_PATTERN -type f -mtime +45  -delete

and this for deleting files older than 30 minutes:

find /PATH/TO/FOLDER/ -name YOUR_FILENAME_PATTERN -type f -mmin +30  -delete