-
-
Save awsp/79fc5d6f027651fa9a38148ba1daa781 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"); | |
$days = 7; | |
foreach($files as $file) { | |
if(is_file($file) | |
&& time() - filemtime($file) >= $days*24*60*60) { | |
unlink($file); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment