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"

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"

About The Author

Deepak Gupta is a IT & Web Consultant. He is the founder and CEO of diTii.com & DIT Technologies, where he's engaged in providing Technology Consultancy, Design and Development of Desktop, Web and Mobile applications using various tools and softwares. Sign-up for the Email for daily updates. Google+ Profile.