Skip to content

Instantly share code, notes, and snippets.

@undergroundwires
Created September 10, 2021 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save undergroundwires/3aa4920fb887cf379f461b57168d369e to your computer and use it in GitHub Desktop.
Save undergroundwires/3aa4920fb887cf379f461b57168d369e to your computer and use it in GitHub Desktop.
clear-all-empty-dirs-on-windows
$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