1

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 1

1

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.

1
  • What script would I need to add to delete files after 14 days?
    – Iestyn
    Oct 1, 2013 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.