I'm looking for a script for Windows Powershell that can recursively delete empty folders. I recently removed a bunch of MP3s from a podcast that had been sorted into different artist folders, but I'm too lazy to delete the folders myself.
Thanks for anyone who can do this for me. ^_^
On Linux, I do:
rmdir *
or
rmdir */*
rmdir */*/*
etc.
Until I get deep enough. Does that work on Windows?
Quote from: iago on April 03, 2008, 09:28:17 AM
On Linux, I do:
rmdir *
or
rmdir */*
rmdir */*/*
etc.
Until I get deep enough. Does that work on Windows?
Nah, rd doesn't recursively remove.
I don't know why they removed deltree from Vista. :(
C'mon Joe, whip up a PowerShell script yourself!
"rmdir" only removes empty folders, which is why it works for me. Does Windows have a function that only removes empty folders?
(it'll be a funny day when I'm on a system where somebody aliases "rm -r" to "rmdir" :) )
rmdir (alias rd) in cmd will only remove empty directories, unless you use /s.
Might want to add /q (quiet) in there so it won't prompt you, not that it's necessary.