There are many empty folders and junk files available on your computer and we donโt even know about it. However, the junk files can be cleaned up, but the empty folders remain. If you want to find and delete the empty folders, check out these methods given below. Use these methods in Windows PC and get rid of all empty folders.
Best Ways to Find and Remove Empty Folders in Windows 10
Everyone has empty folders on the PC, though these folders do not take any space, but they can be annoying. So, letโs check out the different methods to delete Empty folders in Windows.
Also Read- How to Automatically Empty the Recycle Bin on Windows 10
Method 1: Use โforโ and โrdโ commands
By using Command Prompt you can identify the list of folders and delete the empty ones. For that, you must use for
ย andย rd
command.
- First, you need to open the Command Prompt of the current folder, Press & Hold the Shift Key, and do right-click on the folder.
- Now, click on Open Command Window here. (Run the command from the parent folder path to find and remove the empty folder.)
- Once you are in the Command Prompt, run the command
for /f "delims=" %i in ('dir /s /b /ad ^| sort /r') do rd "%i" 2>NUL
Or
for /f "usebackq delims=" %i in (`"dir /s /b /ad | sort /r"`) do rd "%i" 2>NUL
- As you run the above-given command, it will delete all the empty lists from the base folder path including the empty folders.
Do remember, if you are using the above command in a batch file, then replace %i
ย withย %%i
.
Just Find the Empty Folders, & Donโt Delete
If you want to just find the folders but donโt want to delete them, then use the following command-line:
for /r "D:\uploads\2019" /d %F in (.) do @dir /b "%F" | findstr "^" >nul || echo %~fF
You will see the output containing the list of empty folders.
Method 2: Find and Remove empty folders using PowerShell
Use the PowerShell command-line and delete the empty folders that are located under the detailed base folder.
1.) Click on Start Menu, type PowerShell in the search bar, and click on Windows PowerShell.
2.) Start PowerShell and type the command given below
(gci "folderpath" -r | ? {$_.PSIsContainer -eq $True}) | ?{$_.GetFileSystemInfos().Count -eq 0} | remove-item
3.) Replace โfolderpathโ with the base folder location.
(gci "C:\Users\ramesh\AppData\Roaming" -r | ? {$_.PSIsContainer -eq $True}) | ?{$_.GetFileSystemInfos().Count -eq 0} | remove-item
This command deletes all the empty sub-folder under %appdata%
folder. However, this command only clears the last level of the empty folder, if you want to delete another folder then re-run the script and clear another level of a nested folder.
Method 3: Useย DelEmpty.exe
Use a DelEmpty.exe tool from IntelliAdmin to delete empty directories. It can also delete the empty 0-byte files.
For the program, the command-line syntax is:
DelEmpty.exe OPTIONS [PATH]
To open the list of Empty folders:
To open the list of empty folders under the Mozilla directory under AppData, use the command:
DelEmpty.exe "%AppData%\Mozilla" -d -c -s -y -l
This command shows the list of empty folders, and it will not delete the list as the list-only switch is used.
If you are using folder names with space(s),ย then make sure you use the double-quotes around the path.
To delete the List of Empty folder:
Delete the empty folders under Mozilla directory
ย underย %AppData%
, run the same command except theย -l
ย switch:
DelEmpty.exe "%AppData%\Mozilla" -d -c -s -y
The program crosses through every subfolder and deletes the empty folders. Even the Nested empty folders are removed.
Method 4: Useย the โFind Empty Files-n-Foldersโ utility
This tool finds and deletes the empty files (0-bytes) and also empty folders recursively.
- First, download the โFind Empty Files-n-Foldersโ tool from the given link.
- Once, it is downloaded, open it and select the folder
- Click on Scan Now. In separate tabs, the list of empty files and folders will be visible.
- Click on Mark all Folders and then click on Delete Folders
In the same way, you can delete the 0-byte files in the selected folder tree, by clicking on the Empty Files tab.
Method 5: Manually Search for Empty Folders
- First, turn on your PC and open This PC.
- At the top right corner, click on Search Tab to open Search Menu
- Set the Size Filter to Empty
- It will display all files and folders that do not use any memory space.
- Select the folders you want to delete, and do right-click on it, and then tap on Delete.
If you are using this method, you donโt need any software to be installed, it is just based on a search size.