Massive Knowledge? Ache? In search of empty folders and need to delete them? On this submit I present you easy methods to proceed to search out and delete empty folders.
Open PowerShell, ISE or VS Code.
Warning: For those who proceed, all empty folders can be deleted with none warning.
Specify the foundation folder in line 1. In my instance that is C:Knowledge. Then execute the PowerShell code.
All subfolders that are empty can be scanned and deleted with out affirmation.
# Folder empty, then take away them
$path="C:Knowledge"
Get-ChildItem $path -Recurse -Listing | ForEach-Object {
If((Get-ChildItem $_.FullName) -eq $null) {
Take away-Merchandise -Path $_.FullName -Verify:$false -Verbose
}
}
The verbose parameter ensures that you would be able to see every thing that’s taking place.
Mission achieved.
Revealed by