Created
January 28, 2016 05:04
-
-
Save nedarb/840f9f0c9a2e6014d38f to your computer and use it in GitHub Desktop.
Powershell to remove empty folders
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
$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