Hi all
i wrote this code to delete all files that last accessed was after 1 hour ..
it works great if i run the file manually from the browser but it doesn't if i use cron jobs !
i don't know if there is some rules or something ..
PHP Code:
<?
function cleantmp() {
$seconds_old = 60*60;
$directory = "/home/***/public_html/temp";
if( !$dirhandle = @opendir($directory) )
return;
while( false !== ($filename = readdir($dirhandle)) ) {
if( $filename != "." && $filename != ".." && $filename !=".htaccess" ) {
$filename = $directory. "/". $filename;
if( @filemtime($filename) < (time()-$seconds_old) )
@unlink($filename);
}
}
}
cleantmp();
?>
so how can i make it works with cron jobs?
thx all
