Batch
Public
Delete Empty Folders
A Windows CMD snippet that removes empty folders under the current directory.
#cmd
#windows
#cleanup
#folders
Batch
@echo off
for /f "delims=" %%D in ('dir /ad /b /s ^| sort /r') do (
rd "%%D" 2>nul
)
echo Empty folders removed.
pause
Notes
This removes only empty folders. Test it in a safe directory first.