Is there a way to exclude folders missing some files?
E.g. I have folders like:
FolderA
aaa.php
bbb.php
ccc.php
FolderB
aaa.php
bbb.php
ccc.php
FolderC
aaa.php
FolderD
aaa.php
bbb.php
ccc.php
I only want to have FolderA
, FolderB
and FolderD
(or exclude FolderC
) because FolderC
does not have all expected files.
Current Source
$dirs = [];
$finder = new Finder();
$finder->directories()->in(__DIR__)->depth('== 0');
foreach ($finder as $directory){
$dirs [] = $directory->getRelativePathname();
}
print_r($dirs);
Current Output:
array(
[0] => FolderA
[1] => FolderB
[2] => FolderC
[3] => FolderD
)