-
-
Save leonirlopes/06a73f178398db7ade751ea0cff083c3 to your computer and use it in GitHub Desktop.
Deletes .tar.gz files older than 7 days.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$files = glob("*.tar.gz"); | |
foreach($files as $file) { | |
if(is_file($file) | |
&& time() - filemtime($file) >= 7*24*60*60) { // 7 days | |
unlink($file); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment