Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Freeware tool purges empty directories

A program called RMEMPTY offers a way to selectively remove directories from any folder hierarchy.

Please let us know how useful you find this tip by rating it below. Do you have a useful Windows tip, timesaver or workaround to share? Submit it to our monthly tip contest and you could win a prize!

Here's a familiar scenario: After doing extensive cleanup on a \Documents and Settings or \Applications directory, you're left with many empty folders but no way to selectively delete them. The command-line functions for removing directories are all or nothing; there's no way to selectively instruct them to remove only empty ones.

A programmer named Douglas Good became fed up with dealing with this problem, so he came up with a solution: RMEMPTY, a freeware tool for purging empty directories from any folder hierarchy.

RMEMPTY runs as a command-line application. The only parameter that needs to be passed is the name of a directory or pathname, which RMEMPTY will inspect recursively for empty folders. Originally, the program didn't delete the specified directory itself if it was empty after all other processing was completed; it now does this.

To purge multiple folder hierarchies, simply pass multiple pathnames as parameters. For example, rmempty c:\folder1 c:\folder2. The files are never deleted, just the empty folders.

RMEMPTY has one drawback, although I suspect it will be fixed in future revisions: It does not delete empty directories with names that contain Unicode or non-ASCII characters. The source code is also not available, unfortunately, but Mr. Good can be reached at dgood@psea.org if you want to drop suggestions about improvements.

Note: I've found that one useful but rather non-work-related application for this tool is cleaning up all the empty directories left behind in a My Music directory after consolidating and renaming many files. This was actually how I found out about the non-English pathname limitation!

Serdar Yegulalp is editor of the Windows Power Users Newsletter. Check it out for the latest advice and musings on the world of Windows network administrators -- and please share your thoughts as well!

This was last published in July 2005

Dig Deeper on Microsoft Windows XP Pro

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.