How To Delete Files Older Than N Time In PHP

Here is a custom function I made that will delete all files in a folder older than N time.

Time here can be minutes, seconds or hours by using the strtotime() function. So for example, if you want to delete old files less than 4 hours, you can call strtotime(‘-4 hours’).

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *