Hello, I am trying to use a cron entry to clean old files out of an archive directory. I have set it up using the following command:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * find /var/spool/archive -name "?f*" -mtime +1 -exec rm -f {} \;
Every 5 minutes, it checks /var/spool/archive for any files with "f" as the second character in the file name, and deletes it if is more than one day old.
This works fine, but due to the large number of files, I would like to slice it a little thinner.
Is there a way to do the same thing, but delete every file older than 4 hours, rather than a full day?
Thanks for your help!
0,5,10,15,20,25,30,35,40,45,50,55 * * * * find /var/spool/archive -name "?f*" -mtime +1 -exec rm -f {} \;
Every 5 minutes, it checks /var/spool/archive for any files with "f" as the second character in the file name, and deletes it if is more than one day old.
This works fine, but due to the large number of files, I would like to slice it a little thinner.
Is there a way to do the same thing, but delete every file older than 4 hours, rather than a full day?
Thanks for your help!