lundi 12 octobre 2020

How do I get the number of files in folders?

I want to get all folders and the number of files in them, so that these files can be displayed in a tree view for users. There are more files and I started getting an error "RecursiveDirectoryIterator::__construct(/storage/app/public/invoices/2835): failed to open dir: Too many open files".

How can I get around this error without using ajax, but only using php? I also have no way to increase the limit of open files

$aFiles = File::allFiles(storage_path('app/public/invoices/'.$supV->id));
                                
$name = [];

foreach ($aFiles as $aFile) {
      $name[] = array("name" => $aFile->getFilename());
      }

$fileCount = count($aFiles);

$invArray[$key]['date_del'][$k]['test'][$sup] = array("name" => $supV->name, "id" => $supV->id, "count" => $fileCount, "files" => $name);


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire