I have a cache folder that stores html files. They are overwritten when needed, but a lot of the time, rarely used pages are cached in there also, that just end up using sp
/* Detele Cache Files Here */
$dir = "cache/"; /** define the directory **/
/*** cycle through all files in the directory ***/
foreach (glob($dir."*") as $file) {
//foreach (glob($dir.'*.*') as $file){
/*** if file is 24 hours (86400 seconds) old then delete it ***/
if (filemtime($file) < time() - 3600) { // 1 hour
unlink($file);
}
}
I am using this, hope it helps.