Skip to content

Instantly share code, notes, and snippets.

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