May 6, 2008
2:09 am | Last updated: March 2, 2009 at: 2:35 am
Auto delete empty directories with One-line batch script
Raymond Chen, the Microsoft coder, explains that you don't need a whole 260KB program to automatically delete empty subdirectories. You can create a single line batch file that will do exactly what you're looking for:
for /f "usebackq" %%d in ("dir /ad/b/s | sort /R") do rd "%%d"
Loading
1 Response | RSS comments on this post | Leave a comment»
No Pingback yet

This works great as long as there are no spaces in the path...try this instead:
@echo off
for /f "delims=" %%i in ('dir "%~f1" /ad /b /s ^| sort /R') do rd "%%i" 1>NUL 2>&1