25.02.2018 (Sunday)


Removes empty subdirectories from the specified directory.

RmEDir is a small command line utility which allows you to recursively delete all empty subdirectories from the specified directory.

By default, the program also deletes empty directories with the Read-only, System and Hidden attributes (on Windows system), but you can disable it with the --keep-special-dirs switch.

The program has no built-in file deletion function, so you can be sure that no file will be deleted by accident.

RmEDir supports network directories and paths exceeding the MAX_PATH (260) character limit.

License: Freeware, OpenSource.

The application does NOT contain any malicious software. VirusTotal.com scan results:
Windows 32-bit portable Windows 64-bit portable
Linux 32-bit portable Linux 64-bit portable

This program was made for my private use, but it may also be useful to someone.

I use this program when creating backups using the 7-zip archiver, which sometimes leaves empty directories despite the -sdel (delete files after compression) option enabled. RmEDir has also been useful for me in other situations a few times.

If you have to implement in your batch scripts the deletion of empty directories, but you can not use external applications, try one of the solutions from this thread on stackoverflow: https://stackoverflow.com/questions/7831286/how-to-delete-empty-folders-using-windows-command-prompt


RmEDir version 1.0 [Win 64-bit] (2018.01.19)

Usage: rmedir.exe [-r=X] [-d] [-k] [-h] [-V] [--home] Directory

Mandatory arguments to long options are mandatory for short options too.
Options are case-sensitive. Options in square brackets are optional.
The last parameter must be the name of an existing directory.

Available options:

-r, --recurse=X Recursively removes empty directories up to level X in the directory structure (default X=500).
-d, --remove-main-dir It also removes the input directory given on the command line (if empty).
-k, --keep-special-dirs By default, the program deletes empty directories with the Read-only, Hidden and System attributes set. If you want to keep such directories, use this option.
Available only in the Windows version.
-h, --help Show this help.
-V, --version Show application version.
--home Opens program homepage in the default browser.


  1. Delete all empty subdirectories from D:\SomeDir, but do not delete D:\SomeDir even if it is empty:
      rmedir.exe D:\SomeDir
  2. Delete all empty subdirectories from D:\SomeDir, and also delete D:\SomeDir if it is empty:
      rmedir.exe -d D:\SomeDir
  3. Delete all empty subdirectories from the current directory:
      rmedir.exe .\

Tech Info

To compile program from source, you need:
  1. CodeTyphon Programming Studio or Lazarus IDE
  2. My Pascal units from units directory (in the archive with source).
How to build:
  1. Extract 7z archive with source files.
  2. Open src\rmedir.ctpr with CodeTyphon or src\rmedir.lpi with Lazarus.
  3. Set build mode for your destination system.

    Select menu Project -> Project Options... A new window will appear.
    In the tree view (on the left), select Compiler Options.
    At the top of this window you can select the build mode from the dropdown list.
    Choose: Release_Win32, Release_Win64, Release_Lin32 or Release_Lin64.

  4. Build project (menu Run->Build).


Version 1.0 (2018.01.19)
Initial release.