<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$dir = '/FI9805W_xxxE61FFCC/';
$handle = opendir($dir);
$cnt = 0;
$timeout = time()-60*60*24*2;
while(false !== ($file = readdir( $handle ))) {
$absfile = $dir . $file;
if(is_dir($absfile)) continue;
$mtime = filemtime($absfile); // ggf. filectime() statt filemtime() verwenden
printf("%s: mtime = %s, timeout = %s\n", $absfile, strftime("%Y-%m-%d,%H:%M:%S",$mtime), strftime("%Y-%m-%d,%H:%M:%S",$timeout));
if($timeout < $mtime) {
//unlink( $absfile );
printf("%s geloescht\n", $absfile);
$cnt++;
}
}
closedir($handle);
echo 'Anzahl: ' . $cnt;
?>