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

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time