24 時間以上前の古いファイルを削除するために、この php スクリプトを作成しましたが、新しいファイルを含むすべてのファイルが削除されました。
<?php
$path = 'ftmp/';
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ((time()-filectime($path.$file)) < 86400) {
if (preg_match('/\.pdf$/i', $file)) {
unlink($path.$file);
}
}
}
}
?>