if (preg_match('/\.pdf$/i', $file)) {
unlink($path.$file);
}
PHP Snippet 3:
<?php/** define the directory **/$dir = "images/temp/";
/*** cycle through all files in the directory ***/foreach (glob($dir."*") as$file) {
/*** if file is 24 hours (86400 seconds) old then delete it ***/if(time() - filectime($file) > 86400){
unlink($file);
}
}
?>