php - RecursiveIteratorIterator return . and .. for each directory -


i used recursiveiteratoriterator recursive directory lists in linux when try directories have tow version of each directory . , .. :

  'dirs' =>      array (size=13)       0 => string './..' (length=4)       1 => string './..' (length=4)       2 => string './.' (length=3)       3 => string './.idea/..' (length=10)       4 => string './.idea/.' (length=9)       5 => string './.idea/scopes/..' (length=17)       6 => string './.idea/scopes/.' (length=16)       7 => string './images/..' (length=11)       8 => string './images/.' (length=10)       9 => string './test/..' (length=9)       10 => string './test/.' (length=8)       11 => string './test/test2/..' (length=15)       12 => string './test/test2/.' (length=14) 

my code :

$files = [ 'files' => [ ], 'dirs' => [ ] ];    $directories = new recursiveiteratoriterator(new recursivedirectoryiterator('.'));             while ($directories->valid())             {                  if ($directories->isfile())                 {                     $files['files'][] = $directories->getpathname();                 } elseif ($directories->isdir())                 {                     $files['dirs'][] = $directories->getpathname();                 }                  $directories->next();             } 

when use recursivedirectoryiterator::skip_dots blow code :

        $directories = new recursiveiteratoriterator(new recursivedirectoryiterator($path, recursivedirectoryiterator::skip_dots)); 

i don't have result.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -