I never thought I'm gonna need such a program and always wondered how one can come into a situation where he has many empty folders and wants to delete them. Now, I'm in that situation: I have deduplicated a history of backups from 2013 to 2020, i.e. deleted all identical files. That gave me ~2.3 TB of free storage, but the directories remained.

I'm looking for a program that deletes empty directories. A directory may count as empty if it contains other empty directories only.

Now I thought that this is a trivial task, but it seems I was totally wrong. I have a disk with 240.000 empty folders and I tried:

  • RED - Remove Empty Directories. This tool has a nice UI, but is unresponsive during the scanning process. By default it delays 80ms between deleting a directory, which slows down my case to 5:20 hours. That's not acceptable. I reduced that time to 0 ms. But in fact it was only able to delete 1 directory per second! When cancelling the operation, one needs to go through the scanning phase again. Argh!
  • Empty Folder Nuker also needs a long time to find empty directories. It only displayed ~8000 of those 240.000 directories. Why did it take so long to scan them then?
  • WizTree is very fast and tells me that I have 240.000 directories on my hard disk and only about 5000 files. But it has no option to delete empty directories.

I don't want:

  • programming it myself, so please no programming language suggestions

So please, if you have successfully deleted 100.000 empty folders with some tool and you were happy with it, please share it with me. Do not google for results. That's what I did.

  • 1
    Is a Powershell command considered programming? there is an effective solution using that. Nov 14, 2020 at 7:08
  • Good question. I removed it because the community typically uses that tag when online solutions are common or available, but they want an offline solution. For your situation, as you mentioned, only a very contrived solution would have you uploading all your 240,000 empty folders to the cloud just to delete them! :-) Nov 16, 2020 at 9:40
  • Our conversation made me think of a possible solution for you. About how large are the 5000 files, and would you be willing to use a tool that would copy them to another local partition (or drive) as part of the solution? If so, I can check a couple backup tools I use to see if one of them might be able to do the job. Even if they claim to be able to not copy empty folders, I can't promise anything because, well, I have never had 240,000 empty folders. You've piqued my curiosity... how did that happen? Nov 16, 2020 at 9:47
  • @RockPaperLz-MaskitorCasket: I added that to the question. I deduplicated 7 years of backups, so all duplicate files were removed - but the directories remained. The remaining size is 700 GB. A few large files and many smaller ones. - copying that will take more than 2 hours. My new backup solution will deduplicate right away, Nov 16, 2020 at 10:00
  • How many levels deep is the deepest level in the directory tree? Nov 17, 2020 at 0:18

3 Answers 3


Using Powershell.

Go to the parent folder where you'd like to delete its empty childs and type:

ROBOCOPY . . /s /move

  • How is robocopy related to Powershell? Nov 14, 2020 at 22:28
  • Ok, that is "move all files from here to here except the empty ones". Sounds like a quite dangerous command. Not sure if that usage was intended. How did you find this? Is it guaranteed to work also in future versions of RoboCopy? Nov 14, 2020 at 22:31
  • You're right, it can also work in CMD but I am used to PS, anyway, you could try it before, create a folder containing disposable empty and populated subfolders and files and run it from that folder, you'll see the result. And wouldn't it work in future robocopy version, its only parameters are /s and /move and I do not believe they will remove them soon. Nov 14, 2020 at 23:14

A rough and ready tool for doing this is available as rmmpty_tree - it is written in Python 3.8 then built using pyinstaller into a windows 64 bit executable.

Not the fastest nor the most pretty but it will show you which directories are left behind because of existing files.


If you'd remove the Windows tag, I'd have a solution for macOS users, in case they run into this same question:


About this program:

Many macOS folders contain invisible items that a user would consider irrelevant, especially the dreaded .DS_Store file. This tool of mine will effectively ignore such files, i.e. it will report folders that only contain these .DS_Store files as empty, as well as folder that only contain other folders considered empty by this method.

Moreover, the app will list them and allow you to reveal the items in Finder or delete them.

  • 1
    From the name of the link (I don't click on it as one never knows what is hidden behind it), but doesn't this do something like the *nix command find . -type d -a -emptyfor finding?
    – albert
    Feb 16, 2022 at 9:03
  • I expanded my answer accordingly. The find command you proposed would not find folders with .DS_Store items inside, I guess (though you could probably add more rules to make that work?) Feb 16, 2022 at 17:26
  • . files are always a problem, but it looks like my command does find these files as well.
    – albert
    Feb 16, 2022 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.