Automatically Clean Out and Remove Empty Files and Folders

automatically-clean-out-and-remove-empty-files-and-folders photo 1

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.

c:\Folder1\Folder2\EmptyFolder1

c:\Folder1\Folder2\EmptyFolder2

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.

automatically-clean-out-and-remove-empty-files-and-folders photo 2

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

automatically-clean-out-and-remove-empty-files-and-folders photo 3

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

automatically-clean-out-and-remove-empty-files-and-folders photo 4

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

automatically-clean-out-and-remove-empty-files-and-folders photo 5

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

automatically-clean-out-and-remove-empty-files-and-folders photo 6

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

automatically-clean-out-and-remove-empty-files-and-folders photo 7

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

automatically-clean-out-and-remove-empty-files-and-folders photo 8

Download Delete Empty from http://www.intelliadmin.com/index.php/downloads/. 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.

More stories

Shortcuts for Gmail Teaches You Shortcuts On the Fly

Chrome: Gmail has an excellent range of keyboard shortcuts if you just take the time to learn them. You can radically speed up the process with Shortcuts for Gmail, a handy little extension that reminds you of the keyboard sh...

How to Install Extensions From Outside the Chrome Web Store

Try to install an extension from outside the Chrome Web Store and Chrome will tell you that extensions “can only be added from the Chrome Web Store.” However, this message is incorrect – you can still install extensions from elsewhere.

The Role of Airports In Epidemics [Video]

People often joke about how they’ve caught their latest case of the sniffles from a recent flight, but airports can become much more serious disease hubs. Check out this video and accompanying study for a peek at the mo...