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 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 first published in July 2005

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.