lundi 16 novembre 2020

Laravel \Illuminate\Filesystem\Filesystem File:files() count only the files that have specific extension e.g jpg png in all subfolders

i can count files in the folder with this :

 \Illuminate\Filesystem\Filesystem\File::files($path)

then i can count all files in all subfolders (with specific storage)

 foreach ($directories as $directory) {

     $path = Storage::disk($this->disk)->path($directory);

     $files = \Illuminate\Filesystem\Filesystem\File::files($path);
            if ($files) {
                $count += count($files);
            }
     }
}

i can count all files in this folder

How can i count only png or jpeg files with minimum overload?

thanks in advanced!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3pyGOKN
via IFTTT

Aucun commentaire:

Enregistrer un commentaire