Languages:
日本語
  • Linkedin
  • Reddit

Summary :

remove empty directories

Empty files or folders won’t take up your disk space, but some of them are useless and might make it hard to manage your PC. However, it might take you a lot of time if you search for empty folders or files manually. In this post, MiniTool Partition Wizard provides some methods to find and remove empty directories quickly.

Quick Navigation :

It might be frustrating that when you open the subfolders one by one but it turns out empty. Such folders and files might be everywhere on your PC. Most of them are useless and won’t take up any disk space, but you might be annoyed if there are thousands of empty folders or files across your system.

Is it safe to remove empty directories?

Generally, it is safe to delete some of the empty folders or files. For example, you can remove the folders or files from uninstalled program files folders. Of course, if these empty folders are created by yourselves, you can remove them without any worries.

However, some empty folders or files are required by working software or Windows operating system, which means you should not delete them.

It is not recommended to mass remove all empty folders from your system partition and you might need some experience to determine what can be removed safely. If administrative permissions are required when you delete a folder or file, you’d better click No or choose Skip, which also means you’d better not forcefully remove this kind of directories.

How to find and remove empty directories on Windows 10? Here are some methods for you.

Tip: In case you delete the files or folders that shouldn’t be removed, you’d better back up the target partition or the whole disk in advance.

Method 1: Use the Search Feature in File Explorer

File Explorer, previously known as Windows Explorer, is a file manager application provided in Microsoft Windows operating system from Windows 95 onwards. It offers a graphical user interface for accessing the installed disks and almost all the Windows users manage their files and folders stored on the PC via File Explorer.

Of course, you can search for empty directories with this tool. This method is quite easy to operate and here is the tutorial for you. But you can only get empty files from the search results and empty folders won’t be displayed here. If you are looking for empty folders, you might need to try another method.

Step 1: Press Win + E to open File Explorer.

Step 2: Select the drive or folder where you want to find empty directories. Go to the View tab and make sure “Hidden items” has been checked. In this way, you can view all the items searched later.

Step 3: Press F3 or click the search box next to the address bar and the search ribbon will pop up. Make sure the option All subfolders is selected.

Step 4: Now click the Size option in the Refine section of the toolbar and then you can see several pre-defined search options.

  • Empty (0 KB)
  • Tiny (0 – 16 KB)
  • Small (16 – 1 MB)
  • Medium (1 – 128 MB)
  • Large (128 MB – 1 GB)
  • Huge (1– 4 GB )
  • Gigantic (> 4 GB)

Step 5: To search for empty directories, you need to select Empty (0 KB). It might take some time during the searching, and you should wait patiently until it is finished. Then you can delete the empty files according to your needs. By the way, you should make sure you are not opening or using the files you want to delete. Otherwise, you are unable to remove them.

search for empty directories

Tip: Some Windows users encounter problems while using File Explorer, and here are the most common ones:

Method 2: Use Command Prompt to Remove Empty Directories

Command Prompt is a command-line interpreter provided by Microsoft Windows. You can make your computer take specific operations by executing the corresponding commands. To open it, you can press Win + R, type cmd in the box, and press Enter. If you need to run it as an administrator, you can press Shift + Ctrl + Enter instead of Enter.

Command Prompt is not commonly used and it’s risky to use this tool if you are not familiar with it. However, for advanced users, Command Prompt is a powerful tool that can be used to repair some problems and manage the PC.

You can use this tool to delete empty folders from the command line or batch scripts. To remove empty directories, you should follow the steps below.

Step 1: Run Command Prompt as administrator.

Step 2: Type the following commands and press Enter after each to change directory and navigate to the drive where you want to delete empty folders:

  • cd \ (to go to the root level directory from the current directory)
  • g: (replace the letter g with another letter that represents the target drive)
Tip: If you need to go to a specific folder, you should input the command cd /D G:\test instead of the above commands (Replace G with your drive letter and replace test with the target directory).

Step 3: Input the following command line and press Enter to create an EMPTIES.BAT file in the selected directory: DIR /AD/B/S | SORT /R > EMPTIES.BAT.

create an EMPTIES.BAT file

Step 4: Open File Explorer and find the EMPTIES.BAT file. Then open it with Microsoft Word or any other editor. Then you can see the list of all the directories in the target drive.

Step 5: Now you need to add the prefix RD (with space after it) to every line in the file. In Microsoft Word, you can use the Find and Replace feature to make it quickly. You just need to search for “^p” and replace it with “^pRD ” (there is a space after D).

Tip: RD refers to “remove directory”.

use find and replace feature

Step 6: Make sure every line has been added RD before them, especially the first and last lines. Then save the file and exit the editor.

add RD to each line

Step 7: Double-click the EMPTIES.BAT file to run it. Then the empty folders or the folders that contain only empty subfolders will be deleted automatically. You should know that the directory won’t be deleted if it’s not empty. Empty files won’t be deleted either.

Are you looking for a way to find empty subfolders and delete them? This post might be helpful!Click to tweet

Method 3: Use a Third-party Program to Remove Empty Directories

As you can see in the former parts, the first two methods both have their limitations. If you use File Explorer, it would be hard to find empty folders. If you use Command Prompt, you’d better be familiar with this tool and you can only delete empty directories (with empty subfolders).

Fortunately, if you don’t like the above methods, there is another option for you: using a professional third-party program.

Here I recommended MiniTool Partition Wizard, a powerful and professional disk manager with a user-friendly interface. You can use it to manage your partitions, recover data, and test your disk performance. It can also help you find empty files and folders within a few clicks via the Space Analyzer feature.

Compared with the File Explorer and Command Prompt, the Space Analyzer feature of MiniTool Partition Wizard provides optional Folder View and File View while analyzing what’s taking up space on your disk. In this way, you won’t miss any empty folders or files. Now, let’s see how to use this tool.

Step 1: Download and install MiniTool Partition Wizard by clicking the button below and following the onscreen instructions.

Free Download

Step 2: Launch the program and click Space Analyzer from the toolbar when you get the main interface.

click Space Analyzer

Step 3: In the following window, select the target drive where you want to delete empty folders and files. Then wait patiently while it’s analyzing disk space usage.

select a drive

Step 4: By default, MiniTool Partition Wizard will show the Tree View which would be harder to find empty subfolders. To find your empty files or folders quickly, you can choose File View or Folder View. After selecting the view type, you can click the Size button which makes your folders or files be categorized by size. The empty ones will be marked with 0 B.

File View

Folder View

Step 5: Right-click each file or folder you want to remove and select Delete (Permanently). You can also select Delete (to Recycle Bin) according to your needs.

Tip: You can double-click the target item to open it and check if you want to delete it. If you have a lot of files or folders to delete, it might cost you a long time to delete them one by one.

click Delete (Permanently)

How to remove empty directories on Windows 10? Here are three methods. All of them have their pros and cons, and you can choose one you prefer according to your own needs.Click to tweet

Bottom Line

In this post, three methods to remove empty directories are introduced: using the Search feature in File Explorer, using Command Prompt, and using a third-party program. You might prefer different methods as all of them have advantages and disadvantages.

File Explorer is easy to use and you can delete a huge number of files at once, but you can’t search for empty folders.

Command Prompt is relatively hard to operate but it is effective to remove empty directories (folders with only empty subfolders).

MiniTool Partition Wizard is easy to operate and you can find all your empty files and folders, but you need to delete them one by one, which may cost you some time.

You can share your experience with us in the following comment zone. And for any problems with MiniTool Partition Wizard, you can contact us via [email protected].

Remove Empty Directories FAQ

How do I find empty directories?
  1. Search for files of 0 B via File Explorer.
  2. Perform the corresponding command lines in Command Prompt.
  3. Use a third-party program.
How do I delete an empty folder that won't delete?
  1. Restart your PC and try deleting it again.
  2. Scan for virus with antivirus software.
  3. Rename the folder with a shorter name.
  4. Open its Properties and authorize full control.
  5. Back up needed files and delete the folder which contains the empty folder.
  6. Use a third-party application to remove the empty folder.
Can I get my deleted folders back?
Yes, you can. If you delete a folder or file by mistake, you can go to Recycle Bin and restore it to the original location. If you can’t find it in Recycle Bin, you might need a professional data recovery tool to get it back. For more details, you can refer to: How To Recover Permanently Deleted Files In Windows.
  • Linkedin
  • Reddit

User Comments :