There is a directory with subdirectories that you need to go through and perform certain actions for them:

while($dir = readdir($heandler)){ // где $heandler - родительская директория if(!is_file($dir)){ // какие-то действия } } 

So: for one of the folders is_file stubbornly returns true . I don't even know how to diagnose a problem. I watched the output of ls -la - the same output for all directories, so I think the problem is not in the OS. clearstatcache does not help, but renaming a directory solves the problem, only this option does not suit me (the folder is the yii module, too many paths have to be changed).

    1 answer 1

    is_file should get the correct path from the base script. And readdir returns just the name. And if you allow a situation of the form (the structure of directories and files, + put in front of directories)

      script.php test +dir foo bar +test foo1 bar1 

    In this case, the test directory can be a "file". and renaming really helps. Sample code look here .