How-To Geek

Automatically Clean Out and Remove Empty Files and Folders


After cleaning out files on your hard drive, you may be left with a bunch of empty folders you want to delete. Rather than finding them manually, wouldn’t it be easier to use a tool that can find them for you and delete them?

We found a free tool, called Delete Empty, that searches a specified path for empty folders and empty files (files of size zero) and deletes them, deepest paths first. For example, in the following structure, Folder2 is currently not empty, but will become so once EmptyFolder1 and EmptyFolder2 are deleted. Delete Empty will delete EmptyFolder1 and EmptyFolder2 and then discover that Folder 2 is now empty and delete it.



Delete Empty (DelEmpty.exe) is a command line tool, but it’s very quick and easy to use. To use it, open a command line window. The easiest way to do this is to shift-right-click on the folder containing the DelEmpty.exe file and select Open command window here from the popup menu.


A command line window opens directly to the folder containing the Delete Empty executable.

The format for the Delete Empty command is as follows:

DelEmpty.exe OPTIONS [PATH]

The following OPTIONS are available for use in the command:

-f delete files of size zero
-d delete empty directories
-v verbose mode
-c confirm mode (Shows what was deleted)
-s include sub-directories
-l list what would be deleted (lowercase L – does not actually delete the empty folders or empty files)
-y delete without (y/n) prompt

For example, to delete empty directories and empty sub-directories in the mydata directory on C:, type the following command on the command line and press Enter.

DelEmpty.exe -d -s c:\mydata


If you want Delete Empty to prompt you before deleting each empty directory and empty sub-directory, add the -y option to the command, as follows.

DelEmpty.exe -d -s -y c:\mydata


To delete all the empty files, in addition to the empty directories and empty sub-directories, add the -f option to the command.

DelEmpty.exe -d -s -f c:\mydata


If you want to check what directories and files would be deleted before actually deleting them, use the -l (lowercase L) option. For example, the following command will show you what directories, sub-directories and files will be deleted in the mydata directory.

DelEmpty.exe -d -s -f -l c:\mydata


You can also choose to have Delete Empty show you what has been deleted. To do this, add the -c option to the command.

DelEmpty.exe -d -s -f -c -y c:\mydata


To close the command window, type “exit” (without the quotes) on the command line and press Enter.


Download Delete Empty from The program is available in the Free Utilities section.

This handy free tool should help you keep your hard drive free of extraneous directories and files. However, be careful when using the Delete Empty tool. Some programs may need empty folders to run correctly, so be sure not to delete anything you are not sure of.

Lori Kaufman is a writer who likes to write geeky how-to articles to help make people's lives easier through the use of technology. She loves watching and reading mysteries and is an avid Doctor Who fan.

  • Published 08/22/12

Comments (10)

  1. scotsman

    I always preferred R.E.D – Remove Empty Directories myself. Very simple to use and flags up which folder(s) are safe or unsafe to remove.

  2. Mathew Locke

    Awesome, awesome find. I’ve needed something like this for the longest time!

  3. keltari

    Programs like this are dangerous and I would probably avoid them. As stated in the article, there are some programs that rely on directories being there, even if they empty. Ive seen programs crash for this very reason and troubleshooting can be extremely tedious. You might have deleted an empty folder days, or even weeks before you run an application that will crash.

  4. Ashiq

    I think you need to correct this explanation for “-y” option

    If you want Delete Empty to prompt you before deleting each empty directory and empty sub-directory, add the -y option to the command, as follows.

    DelEmpty.exe -d -s -y c:\mydata

  5. IntelliAdmin


    You are mistaken. We made the utility and were worried that people would delete without checking. You need to add the -y to *remove* the prompt. Please do not follow the above advice as it will delete without asking you. Only put the -y if you do not want to be prompted. And I suggest doing this only after you have completed a few test runs.


  6. r

    empty files and folders cause no problems or take up valuable space, but deleting some may.
    Waste your time on other things

  7. Computer Doctor

    Vanity Remover does the same. It’s a free Windows program

  8. Richard

    You can also use this from the command line, no additional programs required:

    for /f “delims=” %i in (‘dir /s /b /ad ^| sort /r’) do rd “%i”

    If you want to use it in a batch file, then you need to replace %i with %%i (in both instances).

  9. venkatesh

    A word of caution – some program files or games require that the required files be therein the directory specified. If not then it is likely to crash. When u delete make it double sure that this file is not required by any of the program or games

  10. bartman2589

    The IOBit Toolbox (bundled with their free Advanced System Care software) has a GUI based utility that lets you specify a starting point to scan for empty folders to remove. Much much easier than trying to properly format a command line based utility’s parameters to do the same thing.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!