Is there a way to clean a directory using PHP after a certain amount of days? I'd like to put the amount of days into a $Cleanup
variable? I've tried and not been able to get it working.
1 Answer
You would need to set a cron job (scheduled task) you set these via the server control panel or with ssh to the server.
You would basically make a script that contained the code to delete all items in the directory and tell the cron task the path of that script, then tell it to run periodically.