有没有办法排除丢失某些文件的文件夹?
E.g。我有像这样的文件夹:
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
)