Why doesn't scandir return some catalogues?
-
Someone had a problem when
scandir()
He's not returning all the contents of the catalogue? In my case, the catalogue is in place. 25 000 Directors, butscandir()
returns 10 590♪ Catalogue rights are the same, they're not hidden, they open through FileZilla. What's the problem?$partnumbers = scandir($pathdir); var_dump(count($partnumbers));die;
-
UPD 2
Check whether https://ru.wikipedia.org/wiki/SELinux it's probably limiting. He can even limit his mouth. Admin at work says he always turns out SELinux completely.
Maybe there's some limits. It's not really good to have that number of catalogues in one directory. Check it again, it's probably the problem.
PHP better use http://php.net/manual/ru/spl.iterators.php , they have to work faster with the big cycles. For example:
$path = realpath('/etc'); $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); foreach($objects as $name => $object){ echo "$name\n"; }
UPD
You can use the generators, by the way, as fast as the heterans even:
function getAllFiles($dirName) { $dh = opendir($dirName); while (false !== ($fileName = readdir($dh))) { yield $fileName; } closedir($dh); }
foreach (getAllFiles('/etc') as $fileName) {
echo "$fileName\n";
}
Speed April
70,000 files on 1Kb and 40,000 directors in one catalogue.
http://joxi.ru/823ja7jHKEYkmO ♪ http://joxi.ru/p27LnqLiEQkPA7 ♪ http://joxi.ru/BA04Lk4iw0YGAy
http://php.net/manual/ru/function.scandir.php He eats an operative, that's understandable, a place to store the data. http://php.net/manual/ru/language.generators.overview.php No speed, sad. Here's the terator. http://php.net/manual/ru/class.directoryiterator.php He won the speed and consumption of the operatives.
"A match" of course, but I think it''s gonna be visible at a very large volume.