Created
May 20, 2015 11:25
-
-
Save alexinnes/850d2e88a418b6c8765f to your computer and use it in GitHub Desktop.
Finds empty folders and removes them.
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
#Enter top level location here | |
$filelocation = "" | |
#Remove the -whatif at the end if you want it to actually remove the folders | |
(gci $filelocation -r | ? {$_.PSIsContainer -eq $True}) | ?{$_.GetFileSystemInfos().Count -eq 0} | Remove-Item -verbose -whatif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment