简体   繁体   中英

PHP scandir limit of files number

I have a folder in my webserver that contains 81633 files in. I can see that by using the command: ls | wc -l ls | wc -l

When I use scandir function it returns me only 80476 files:

$files = scandir($_SERVER['DOCUMENT_ROOT'] . "/assets/doc/bons/");
echo count($files);

The same result with:

$d = new DirectoryIterator($dir) or die("getFileList: Failed opening directory $dir for reading");
$cnt = 0;
foreach($d as $fileinfo) {
      $cnt++;
}
echo $cnt;

result: 80476 files

All files have the same permissions. Is there some kind on limitation on PHP side or on file system side? Any help would be appreciated.

ls | wc -l ls | wc -l is not the right way to count files.

This is how to count files .

See also: https://unix.stackexchange.com/questions/113463/use-of-ls-with-wc-command

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM