首页 > 解决方案 > Unlink/Delete files which starts with a dot

问题描述

I'm trying to delete (unlink) files which starts with a dot.

This is my approach:

$dirList = glob('*');
foreach ($dirList as $file) {
  if(time() - filectime($file) > 7200) {
     unlink($file);
  }
}

Its deleting every file which is older than 2 hours, but only those which dont start with a dot. Files which starts with a dot are not deleting. How can I solve this? I was thinking about using exec, but I want to use the php way if there are any possibilities to solve this using php.

标签: php

解决方案


推荐阅读