$delhours=1; $dir="."; $d = dir ($dir); while(false!==($entry = $d->read())) { if ($entry != "." && $entry != "..") { if (Is_file("$dir/$entry")) { if(filectime("$dir/$entry")<time()-$delhours*3600) unlink("$dir/$entry"); } } } $d->close();