php - Cron job to delete files created before a specific time -
i have cron job empty temp folder have once day:
rm -rf /home/username/public_html/temp/*
i want cron job delete files created before run 5 minutes , make sure script don't need these files anymore.
let's set cron job run everyday @ 10:00 .. want delete files in folder created before 09:55 am
thank experts!
if you're using gnu find
, try this:
find /home/username/public_html/temp -type f -mmin +5 -delete
should work freebsd or many other versions of find
.
Comments
Post a Comment