This guide shows you how to find and delete empty folders in Windows 10, either manually or with a simple command, to keep your file system tidy. You’ll need a Windows 10 PC and, for the automated method, a basic understanding of using Command Prompt.
What You’ll Need
- A Windows 10 computer with administrator access (optional but recommended for system folders).
- Basic familiarity with File Explorer and, for the command-line method, Command Prompt.
Step-by-Step
Method 1: Manual Deletion (for a few folders)
- Open File Explorer (Win + E).
- Navigate to the drive or folder where you want to remove empty subfolders.
- Click the View tab and check Hidden items to see hidden empty folders (they are often empty but hidden).
- Right-click on an empty folder and select Delete. If it’s not empty, Windows will ask for confirmation; if it is empty, it deletes immediately.
- Repeat for each empty folder. This is fine for a handful but tedious for many.
Method 2: Using Command Prompt (for many folders)
- Open Command Prompt as administrator: press Win + X and select Command Prompt (Admin) or Windows PowerShell (Admin).
- Type the following command and press Enter. Replace
C:\path\to\your\folderwith the actual path (e.g.,D:\Downloads). This command lists all empty subfolders under that path, including hidden ones.dir /s /b /ad "C:\path\to\your\folder" | sort /r - To delete them all in one go, use this command. It removes all empty directories in the specified path, including nested ones. Be careful—this is permanent and does not ask for confirmation.
for /f "delims=" %i in ('dir /s /b /ad "C:\path\to\your\folder" ^| sort /r') do rd "%i" 2>nulNote: If you are running this in a batch file, double the percent signs (
%%i). - After running, check that the folders are gone. The
2>nulsuppresses errors for folders that are not empty (so they remain).
Method 3: Using PowerShell (alternative)
- Open PowerShell as administrator (Win + X, then choose Windows PowerShell (Admin)).
- Run this command to find empty directories in a path:
Get-ChildItem -Path "C:\path\to\folder" -Recurse -Directory | Where-Object { (Get-ChildItem $_.FullName -Force).Count -eq 0 } | Remove-Item -Force -RecurseThis removes all empty directories recursively. It also deletes hidden empty folders because of the
-Forceflag.
Common Mistakes
- Not checking hidden items: Many empty folders are hidden by default, so they won’t show in File Explorer unless you enable hidden items.
- Deleting system folders: Some empty-looking folders are needed by Windows or apps. Avoid deleting folders in
C:\WindowsorC:\Program Filesunless you are certain they are safe. - Using the command without testing: The command-line method deletes instantly without a recycle bin. Test on a small folder first.
- Forgetting the
2>nulin the for command: Without it, you’ll see error messages for folders that aren’t empty, but it still works. With it, errors are hidden.
Tips
- Before deleting, run the
dircommand to see a list of what will be removed. You can redirect the output to a text file for review:dir /s /b /ad "C:\path" > empty_folders.txt. - If you want to remove empty folders on a schedule, create a batch file with the
forcommand and run it via Task Scheduler. - Use the
rdcommand with the/sflag to remove a folder and its subfolders, but that removes non-empty ones too, so avoid it here. - For a graphical approach, you can sort folders by size in File Explorer (View > Sort by > Size) to spot empty ones (size 0 KB).
Troubleshooting
- Command says “The system cannot find the file specified”: This usually means the path is incorrect. Double-check the path, including drive letters and backslashes. Use quotes around the path if it contains spaces.
- Folders are not deleted even though they appear empty: They might contain hidden files or system files. Use the
-Forceflag in PowerShell or the/aswitch in thedircommand to include hidden files. For example:dir /s /b /ad /a "C:\path". - Access denied errors: Some folders are protected by Windows. Run Command Prompt or PowerShell as administrator. If that fails, the folder might be in use; close any programs that might be using it.
- The command deletes non-empty folders too: The
forcommand withrdshould only remove empty ones becauserdfails on non-empty folders. If you usedrd /s, that would delete everything. Make sure you did not include/s. - PowerShell command errors with “Cannot bind argument”: This is often a quoting issue. Ensure the path is in quotes and that you are using the exact syntax. Try running the command without the
-Recursefirst to test.
Frequently Asked Questions
Will deleting empty folders speed up my PC?
Generally no, empty folders take up negligible disk space. The main benefit is organizational—it makes it easier to navigate your files.
Can I recover deleted empty folders?
If you delete them manually (via File Explorer), they go to the Recycle Bin and can be restored. If you use the command-line method, they are permanently deleted and cannot be recovered easily. Always double-check before running the command.
Why do some empty folders reappear after deletion?
Certain applications (like cloud sync services, anti-virus, or system processes) may recreate folders they expect to exist. If a folder keeps coming back, it’s likely needed by a program—consider leaving it.
How do I delete empty folders in a specific folder without touching subfolders?
Use the command without /s in the dir part, or manually select them. For example: for /f "delims=" %i in ('dir /b /ad "C:\path"') do rd "C:\path\%i" 2>nul – this only checks immediate subfolders.
Is there a way to see empty folders in File Explorer?
Yes, switch to Details view and add the Size column. Empty folders will show 0 KB. You can also sort by size to group them.
Can I use third-party tools to do this?
Yes, many file management tools have a “find empty directories” feature. However, the built-in methods above are free and safe, so third-party tools are not necessary.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Roku Channel: 7 Ways to Watch & Stream
- Check AirPods Charging Case Battery Status
- iPhone Won’t Turn On: How to Fix a Dead Device
- How to Restore Missing Stereo Mix on Windows 10
- Fix Microsoft Teams Notifications Not Working on Mac
- Fix Unable to Uninstall Apps in Windows 11