You can use this utility: Remove Empty Directories utility.
Alternatively you can use this one-liner batch file (from DownloadSquad):
for /f "delims=" %d in ('dir /s /b /ad ^| sort /r') do rd "%d"
(if used inside a batch file, replace %d
with %%d
)
(This This works because rd
will not remove a directory that contains files.)
One-liner taken from DownloadSquad, an excellent site to add to your RSS feeds. :)