I have a website on a shared Apache server running PHP 5.2.17. There is a subdirectory named zip in the root folder of the website. The website generates downloads, on the fly, of multiple files packed in ZIP files for end users to then download. Trouble is these massive ZIP files never get deleted after they have served their purpose. They range in size for 5 mg to 500 mg each. On any given day there may be 25 legacy zip files stored in that subdirectory.
I need you to write a simple PHP script that, when called, will mass delete all the files in that sub that are > than 24 hours, or one day old. I don't want a mass kill of all files because someone may be in the middle of a download when the script is called.
Believe me, there are plenty of "free" PHP scripts that purport to do this exact same thing. All I have to is modify the script to point to the zip folder and invoke it. NONE of them work, so I don't want some old script YOU found on the internet that I already know doesn't work. This should be an easy task for an experienced PHP developer and I won't pay a lot for such a simple script. My main concern is how I test the script to make sure it works before I release funds. Maybe through a milestone payment. If it doesn't work on my hosted generic, shared Apache server, you don't get paid... :-)
I intend to invoke the script via a CRON job once a day via the Cpanel cron job setup. I am easy to wotk with but I need all the code WELL commented so I can follow your logic, but mainly it has to work as describe above.