I searched some related questions but unable to understand them.
I want to delete all the files of folder after every 24 hours but sometimes I get warnings and sometime it works. The folder path is c:\wamp\www\Jamil
.
Here's the source:
<?php
$dir = "Jamil"; // directory name
foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..')
continue;
if((time() - filemtime($item)) >= 30 && is_file($item)){
unlink($dir.DIRECTORY_SEPARATOR.$item);
echo "All files deleted";}
}
//rmdir($dir);
?>
I copied the code from various sites. Can anyone help? I get this warning:
Warning: filemtime() [function.filemtime]: stat failed for jamil.html in C:\wamp\www\delete1.php on line 10