Skip to content

Instantly share code, notes, and snippets.

@Xeroday
Xeroday / delete-targz.php
Created July 21, 2013 22:27
Deletes .tar.gz files older than 7 days.
<?php
$files = glob("*.tar.gz");
foreach($files as $file) {
if(is_file($file)
&& time() - filemtime($file) >= 7*24*60*60) { // 7 days
unlink($file);
}
}
?>