yes you can survive your files with my custom function.
public function deleteBackupFiles() {
$filelist = array();
if ($handle = opendir(Mage::getBaseDir('var') . DS . "backups" . DS)) {
while ($entry = readdir($handle)) {
//if ($this->endsWith($entry, "_db.gz")) {
if ($this->endsWith($entry, "nomedia.tgz")) {
$filelist[] = $entry;
}
}
closedir($handle);
}
foreach ($filelist as $each_file) {
/* echo "<br> $filename was last modified: " . date ("Y-m-d h:i:s", filemtime(Mage::getBaseDir('var') . DS . "backups" . DS.$each_file));
$last_modi = filemtime(Mage::getBaseDir('var') . DS . "backups" . DS.$each_file); */
if (time() - filemtime(Mage::getBaseDir('var') . DS . "backups" . DS . $each_file) >= 7 * 86400) { // where 7 is days
unlink(Mage::getBaseDir("var") . DS . "backups" . DS . $each_file);
}
}
}
Edit
cron tab should look like
<crontab>
<jobs>
<your_custom_tag_backup_files>
<schedule>
<cron_expr>0 4 * * *</cron_expr>
</schedule>
<run>
<model>yourmodel/observer::deleteBackupFiles</model>
</run>
</your_custom_tag_backup_files>
</jobs>
</crontab>
Add this function to your custom model / observer and run it with cron expression.
let me know if i could help you more