$dir = 'D:\test'; if(is_dir($dir)) { $dh = opendir($dir); while (false !== ($file = readdir($dh))){ if(!is_dir($dir.'/'.$file)) { $arr = pathinfo($file); if(!isset($arr['extension'])) { unlink($dir.'/'.$file); } } } }?>
循环遍历文件,文件名不包含' . '的删除