November 2018
Intermediate to advanced
566 pages
17h 15m
English
You will need to rerun the command to create the empty directories. Follow these steps to get started:
$Iteration = 0
do {
$AllDirectories = (Get-ChildItem -Path $HOME/random -Recurse -Directory).FullName
$EmptyDirectories = $AllDirectories | Where-Object {(Get-ChildItem $PSItem).Count -eq 0}
$EmptyDirectories | Remove-Item
$Count = $EmptyDirectories.Count
Write-Output "Iteration $Iteration`nRemoved the following $Count directories. '$Count = 0' is $($Count -eq 0)"
$EmptyDirectories
$Iteration++
} until ($Count -eq 0)
Note how there was an empty iteration 5, just like with the
Read now
Unlock full access