dreamwest Posted June 10, 2009 Share Posted June 10, 2009 I wanted to place a script on a directory that would delete all files 15 minuets or older $dir = "/home/user/public_html/tmp"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; } closedir($dh); } } Quote Link to comment https://forums.phpfreaks.com/topic/161637-delete-files-in-directory/ Share on other sites More sharing options...
RichardRotterdam Posted June 10, 2009 Share Posted June 10, 2009 Use filemtime to get the modified date of a file. Quote Link to comment https://forums.phpfreaks.com/topic/161637-delete-files-in-directory/#findComment-852920 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.