Created
September 10, 2021 18:55
-
-
Save undergroundwires/3aa4920fb887cf379f461b57168d369e to your computer and use it in GitHub Desktop.
clear-all-empty-dirs-on-windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tdc="D:\uncategorized\" | |
do { | |
$dirs = Get-ChildItem $tdc -Directory -Recurse | Where { (Get-ChildItem $_.FullName).count -eq 0 } | Select -ExpandProperty FullName | |
foreach($dir in $dirs) { | |
Remove-Item "$dir" # Use -Force for removing hidden items | |
} | |
} while ($dirs.count -gt 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment