Delete Files Older than 7 Days Via Cron PHP Job
A tutorial on how to delete files from a specific folder that are older than 7 days via a CRON Job. This is in PHP Language.
This will show you how to delete files from a certain folder that are older than 7 days.
$files = glob("folder/*"); if($files){ $now = time(); foreach ($files as $file) { if (is_file($file)) { if ($now - filemtime($file) >= 60 * 60 * 24 * 7) { // 2 days unlink($file); } } } }