有没有办法排除缺少某些文件的文件夹?
例如,我有如下文件夹:
FolderA
aaa.php
bbb.php
ccc.php
FolderB
aaa.php
bbb.php
ccc.php
FolderC
aaa.php
FolderD
aaa.php
bbb.php
ccc.php
我只想拥有FolderA
,FolderB
和FolderD
(或排除FolderC
),因为FolderC
没有所有预期的文件。
当前来源
$dirs = [];
$finder = new Finder();
$finder->directories()->in(__DIR__)->depth('== 0');
foreach ($finder as $directory){
$dirs [] = $directory->getRelativePathname();
}
print_r($dirs);
电流输出:
array(
[0] => FolderA
[1] => FolderB
[2] => FolderC
[3] => FolderD
)