LOGO

Automatically Clean Empty Files and Folders

August 22, 2012
Automatically Clean Empty Files and Folders

Removing Empty Folders and Files with Delete Empty

Following file cleanup on your hard drive, numerous empty folders may remain. Instead of locating and deleting these manually, a specialized tool can automate the process for increased efficiency.

Delete Empty is a free utility designed to scan a designated path for empty folders and zero-size files, removing them in a hierarchical order. For instance, consider this directory structure: if EmptyFolder1 and EmptyFolder2 are removed, Folder2 will subsequently become empty and be deleted by Delete Empty.

c:\Folder1\Folder2\EmptyFolder1

c:\Folder1\Folder2\EmptyFolder2

Using the Command Line Tool

Delete Empty (DelEmpty.exe) operates through the command line, but its usage is straightforward. Begin by opening a command line window. A convenient method is to shift-right-click within the folder containing DelEmpty.exe and select "Open command window here" from the context menu.

automatically-clean-out-and-remove-empty-files-and-folders-1.jpg

The command line will then be directly positioned in the directory housing the Delete Empty executable.

The command syntax for Delete Empty is as follows:

DelEmpty.exe OPTIONS [PATH]

Several OPTIONS can be utilized within the command:

  • -f

    Deletes files with a size of zero bytes.

  • -d

    Deletes empty directories.

  • -v

    Enables verbose mode, providing more detailed output.

  • -c

    Activates confirm mode, displaying items before deletion.

  • -s

    Includes sub-directories in the search.

  • -l

    Lists files and folders that would be deleted without actually deleting them (lowercase 'L').

  • -y

    Suppresses the confirmation prompt (yes/no).

To remove empty directories and sub-directories within the 'mydata' directory on your C: drive, enter the following command and press Enter:

DelEmpty.exe -d -s c:\mydata

automatically-clean-out-and-remove-empty-files-and-folders-2.jpg

If you prefer Delete Empty to request confirmation before deleting each item, incorporate the -y option:

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

automatically-clean-out-and-remove-empty-files-and-folders-3.jpg

To delete both empty files and directories, include the -f option:

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

automatically-clean-out-and-remove-empty-files-and-folders-4.jpg

To preview the changes without actually deleting anything, use the -l option:

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

automatically-clean-out-and-remove-empty-files-and-folders-5.jpg

You can also have Delete Empty display a list of deleted items by using the -c option:

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

automatically-clean-out-and-remove-empty-files-and-folders-6.jpg

To close the command window, type “exit” and press Enter.

automatically-clean-out-and-remove-empty-files-and-folders-7.jpg

Downloading Delete Empty

Download Delete Empty from http://www.intelliadmin.com/index.php/downloads/. It is located within the Free Utilities section.

This tool offers a convenient way to maintain a clean hard drive. However, exercise caution when using Delete Empty, as some applications may rely on empty folders for proper operation. Avoid deleting anything if you are uncertain of its purpose.

#empty files#empty folders#clean up#remove files#remove folders#disk space