I’m trying to create a cron job which will automatically delete .jpg files from a particular folder that haven’t been accessed for more than 5 days. Running the cron job is not a problem, but how do I go about writing the script which will take care of the deletion?
Share
Assuming your filesystem is mounted with atime / relatime options you can use fileatime() to detect the last access time.
So something like: