delete old cached files by cpanel cronjob
hello every body
i want to know how can i delete my old cached files in one directory by setting cronjob for 4:00 am
if i can do it by date, it will be awesome! like delete old file more than 1 week
and if it cant be possible, so delete all my cache file in the cache folder every 1 week
thank you everyone
-
You can add this cron as root with crontab -e 0 4 * * * find /path/to/files* -mtime +7 --delete This will at 4 am every day delete the files in the path older than seven days. 0 -
You can add this to the cPanel interface for the account you're wanting to delete the cache files for. You do want to be careful you're only deleting the cache files specifically as well. 0 -
I would suggest using this command: find /path/to/files -type f -mtime +7 -exec rm -f {} \;0
Please sign in to leave a comment.
Comments
3 comments