Recursively delete empty directories in Windows
Fresh3 days ago
Mar 15, 2026221220 viewsConfidence Score1%
1%
Problem
I have a directory on my Windows 7 machine that has hundreds if not thousands of sub-directories. Some of them have files, some do not. I want to delete all the empty directories. Looking at the del and rmdir DOS command, it does not look like you can recursively do this without deleting all the files. Is there a way to do this from the command line?
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Recursively delete empty directories in Windows
Low Risk
You can use Remove Empty Directories utility. Alternatively you can use this one-liner batch file (from DownloadSquad): (if used inside a batch file, replace with ) This works because will not remove a directory that contains files.
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix