Skip to content

Commit 7cb0aae

Browse files
committed
doing multiple passes to remove empty directories
1 parent 3ec15bb commit 7cb0aae

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

FallBackFolderBuild/generateFallBackFolder.ps1

+9-6
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,15 @@ try {
125125

126126
# renaming the nuget cache folder to Fallback
127127
Rename-Item .\.nuget $fallBackFolder
128-
$emptyDirectories = Get-ChildItem -Path $fallBackFolder -Directory -Recurse | Where-Object { $_.GetFileSystemInfos().Count -eq 0 }
129-
Write-Host "Removing following empty directories"
130-
$emptyDirectories | ForEach-Object {
131-
Write-Host $_.FullName
132-
Remove-Item $_.FullName
133-
}
128+
129+
Do {
130+
$emptyDirectories = Get-ChildItem -Path $fallBackFolder -Directory -Recurse | Where-Object { $_.GetFileSystemInfos().Count -eq 0 }
131+
Write-Host "Removing following empty directories"
132+
$emptyDirectories | ForEach-Object {
133+
Write-Host $_.FullName
134+
Remove-Item $_.FullName
135+
}
136+
} while ($emptyDirectories -ne $null)
134137

135138
# for matching before and after
136139
foreach ($extension in $extensions) {

0 commit comments

Comments
 (0)