<?
// The snippet of code earlier that allows you to delete all files older than 2 weeks uses the function (filemtime) - which checks the original create date of the file (filesystem independent). You MAY want to use filectime() - that looks at when the file was last changed on YOUR file system.
$path = "MyImages/";
if (is_dir("$path") )
{ echo "Have the dir";
$handle=opendir($path);
echo "handle=" . $handle;
while (false!==($file = readdir($handle))) {
echo "<br>File=" . $file;
if ($file != "." && $file != "..") {
echo "Have a valid file"; //filectime or a
$Diff = (time() - filemtime("$path/$file"))/60/60/24;
echo "Diff=" . $Diff;
if ($Diff > 2) unlink("$path/$file");
}
}
closedir($handle);
}
?>:D