Just curious
$files = glob(cacheme_directory().\"*\");
foreach($files as $file)
{
$filemtime=filemtime ($file);
Here is an example of how to do it recursively.
function remove_files_from_dir_older_than_x_seconds($dir,$seconds = 3600) {
$files = glob(rtrim($dir, '/')."/*");
$now = time();
foreach ($files as $file) {
if (is_file($file)) {
if ($now - filemtime($file) >= $seconds) {
echo "removed $file
".PHP_EOL;
unlink($file);
}
} else {
remove_files_from_dir_older_than_x_seconds($file,$seconds);
}
}
}
remove_files_from_dir_older_than_x_seconds(dirname(__file__).'/cache/', (60 * 60 * 24 * 1) ); // 1 day