Skip to content

Instantly share code, notes, and snippets.

@nedarb
Created January 28, 2016 05:04
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 nedarb/840f9f0c9a2e6014d38f to your computer and use it in GitHub Desktop.
Save nedarb/840f9f0c9a2e6014d38f to your computer and use it in GitHub Desktop.
Powershell to remove empty folders
$toDelete = Get-ChildItem . -recurse | Where-Object {$_.PSIsContainer -eq $True} | Where-Object {$_.GetFiles().Count -eq $_.GetFiles("*.ini").Count -and $_.GetDirectories().Count -eq 0} | Select-Object FullName
foreach ($dir in $toDelete) { Remove-Item $dir.FullName }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment