Batch-delete empty folders in Windows and Mac OS X

ADVERTISEMENT

After using Windows for several months, chances are, that parts of your hard drive will contain many empty folders nested several levels deep. One of the reasons for this is frequent installation and uninstallation of software – some poorly-designed installers are the culprits here and leave empty folders after uninstall.

Needless to say, it is impossible to delete such empty folders by hand. We need an automated way to do this – use a tool like Remove Empty Directories. It is freeware and comes in two versions – one requires admin rights (and removes empty folders more effectively) and a normal version.

Steps to remove empty folders

On Windows

:

  1. Download RED and install it. Choose the “Windows installer (Admin edition)”.
  2. Open RED. Under Scan, choose a folder and hit Scan Folders.
  3. After scan is done, the list of folders to be deleted is shown. Review a few folders to ensure that the program is not picking any non-empty folders. You can do this by right-clicking and opening them in Windows Explorer.
  4. Hit Delete Folders button.
  5. Now, empty Recycle Bin, as it contains all the deleted folders.

On Mac OS X

:
Method #1: Download and run the Delete Empty Folders AppleScript based tool. Delete Empty Folders is a tiny utility that searches a selected folder in Finder, deletes .DS_Store files, then trashes empty directories. It uses the find command in a shell.

ADVERTISEMENT

Note that this might not work properly with OS X Lion, seeing as how the app has not been updated since 2009. Lion users can try method #2 or #3 instead.

Method #2: Alternativly, you can run the find command manually. Open up a Terminal window in OS X, then run the command below:

find path -type d -empty -delete

where /Users/Sumesh/Documents/ is the folder to be searched. Modify the path and type according to your needs and execute the command. It searches and deletes empty folders in one step.

Method #3: You can also search for empty folders from Spotlight. To do so, go to the folder you want to search. For search criterion, apply Kind: Folders, and also pick “Other..”. Then, select “Number of items” and set it to “Less than: 1”.

On Linux

Linux users can download a freeware called FSLint. It is a system cleaner app designed to clear out useless files and folders, including empty folders.

A command on the shell can also be used, as below:
find -depth -type d -empty -exec rmdir {} \;