Home > Resources > How to remove all empty folders in Windows

How Do I Find All Empty Folders in Windows and Remove Them - Quick & Safe

Chelsea Staub Updated on Apr 15, 2022 4:59 PM

Like the junk files and folders that takes up much memory space, empty folders - the directories whose size are 0 byte and don't occupy hard disk storage space - also pose challenges to your Windows computer's organization and efficiency. Maybe hundreds of empty folders and subfolders that are left behind program uninstallations or system glitches make it to take forever to search the target folder. Perhaps there're still countless empty directories that contain no files or subdirectories to clean up - including the inaccessible or hidden ones - after a big file duplicate erase job.

If you're seeking for ways to delete empty folder in Windows safely and quickly, you've come to the right place. Before you dive deeper to find empty folders and delete them all, make sure you have all necessary permissions to access the 0-byte folders first. If you've deleted a non-empty folder that's essential when removing empty folders in Windows computer, get it back at here.

Full Guide on the Removal of Empty Directories in a Windows PC:

  • Use Search Tools
  • Use Remove Empty Directories software
  • Use Command Prompt
  • Use Robocopy (Robust File Copy) tool
  • Use PowerShell
  • Use a Registry Cleaner

This article applies to all versions of Windows operating system, including Windows 10, Windows 8, and Windows 7, Vista and XP.

Use Search Tools

Without having any software installed, you can directly find and remove all empty folders only in Windows PC through Microsoft Search Tools. All you need to do is to configure filter for storage memory to zero byte, and select the needed empty folders to delete from the searching results.

  • Click to open My Computer.
  • Choose the Search tab at the top line.
  • In the opening Search Menu, set Size filter to Empty (0 KB) and check All subfolders option.
  • From the list of the files and folders that don't take up any disk space, right-click the empty folder(s) and select Delete.

Also see: How to Recover Permanently Deleted Folders on Windows 8

Use Remove Empty Directories Software

If Windows can't find the empty folders after searching this PC, the free Remove Empty Directories software should come into play. It can speed through the selected drive, search the directories that show 0 bytes in properties and then remove empty folders automatically in Windows. It marks each empty folder red so that you can review carefully before performing empty folder deletion.

Rest assured that it's safe to delete empty folders in Windows and other folders that protected by Windows OS will leave untouched. Click here to download the Recover Empty Directories. Once done, follow the easy wizard below to install it:

  • Click on the installer and choose Next button.
  • Tick the box next to I accept the agreement and hit Next.
  • Specify the location to store the tool and press Next to confirm.
  • Select Next button to go on.
  • If needed, check Create a desktop icon. Then, click on Next button.
  • Hit Install. When it's done, choose the Finish button.

Then, the following instructions will show you how to delete empty folders in Windows computer:

  • Launch the tool and customize the configuration of the search in Settings tab.
  • Empty Folder Deleting Tools for Windows

  • Go to Scan tab and click on Scan folders button. The folders with red names will be deleted.
  • Find a Folder That Are Completely Empty in Windows Hard Drive

  • When the scanning ends, hit Delete folders. It'll start deleting the empty folders.
  • When all the empty folders are deleted, exit the application.

Should you only want to find the empty folders but don't delete in PC, just browse to the directories in red and click on Exit button to shut down the program when the checking ends.

Use Command Prompt

Another way to go is to delete empty folders using Windows Command Prompt. If you don't get acquainted with command line, it's recommended to run through the whole procedure for few times before start.

The steps to use "DIR" and "SORT" command to find and remove Windows empty folder:

  • Type Command Prompt in the search bar and click Command Prompt. A console will open.
  • Enter this command line DIR /AD/B/S | SORT /R > EMPTIES.BAT. The EMPTIES.BAT file should list all your folder in reverse order.
  • Open up the file in Word or other compatible editors.
  • Use the "Find and Replace" function in Word to search the structure ^p and replace with ^pRD.
  • Save the EMPTIES.BAT file and close the editor.
  • Run the file, and it'll start deleting all the folders listed.

The steps to use "for" and "rd" commands to find and clear all empty folders recursively:

  • Press and hold the Shift key, and right-click on the folder where you need to find and remove empty sub-folders, and choose Open command window here. A console will open.
  • In the Command Prompt window, run this command line:
  • for /f "delims=" %i in ('dir /s /b /ad ^| sort /r') do rd "%i" 2>NUL

Then, all the empty directories should get removed from the given folder path.

Use Robocopy (Robust File Copy) tool

If you prefer recursively copying a directory but excluding all empty subfolders from Windows hard drive, Robocopy works like a charm. It's built right into the Windows operating system and serves a ton of options allowing you to not only find and delete empty folders in a give path, but also to do file transfer, syncing, etc. Click here to learn more guidance of other command lines in Robocopy.

Now, we'll use "move" command to moves directories from source path to the destination path and use "/S" command to delete empty folders automatically during the copy. Let's say that you have a folder called Temp where there're a few subdirectories to clear away from C: drive, and here's how to delete empty folders from a given directory in Windows machine:

  • Open a Command Prompt window.
  • Type this command: robocopy "C:\Temp" "E:\Temp" /S /move, and then press Enter.

Can't Delete Windows Empty Folder because It Is Used

After a while, the empty folders should be gone. If you want find empty folders without deleting them, add "/L" to the end of the command above to inform the tool to list empty directories only.

Use PowerShell

Aside from Command Prompt tool, Windows PowerShell can also find and delete empty folders recursively from a Windows-based computer. How it works is included below:

  • Launch PowerShell and enter the following command: (gci "folderpath" -r | ? {$_.PSIsContainer -eq $True}) | ?{$_.GetFileSystemInfos().Count -eq 0} | remove-item
  • Replace folderpath with your folder location, just as the image shown below.

  • Press Enter key. Then, it'll recursively delete empty directories from the target folder.

Likewise, the PowerShell also grants you to locate the empty folders only rather than delete them all and make it easy to do this.

  • Open PowerShell and enter the following command: (gci "folderpath" -r | ? {$_.PSIsContainer -eq $True}) | ?{$_.GetFileSystemInfos().Count -eq 0} | select FullName | Out-GridView
  • Tips: Remember to replace folderpath with your folder location

  • Hit Enter and then you should see a list of empty folders with detailed paths in a grid view control.

Use a Registry Cleaner

If you're set on removing empty folders and other redundant files or directories, it's worth to try a Registry Cleaner program. Most of these tools come with customizable scanning and cleaning options, with which you can easily mass delete empty folders in PC, as well as other unnecessary items that you want to wipe away.

By clicking "Agree" you allow cookies that improve your experience on our site, help us analyze site performance and usage. See Cookies policy.Agree