I have this to kill some older files, backups...
PHP Code:
$dir = '/www/';
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file[0] == '.' || is_dir("$dir/$file")) {
continue;
}
if ((time() - filemtime($file)) > ($days *86400)) { //7 days
unlink("$dir/$file");
}
}
closedir($handle);
}
Any idea how i can change this
"kill all older than 7 days",
into
"kill all BUT the latest three" <- so, could be there's one in there that is weeks old, as long as no new ones appear
I have had TM3 break and the kill older than x days backups. When we found out TM3 was broken, it had also killed all good backups already
Anyone? We're going to cron this.