Empty Directories Remover

If you use meta files and Git in Unity projects, you may have encountered the problem with empty directories.

What is the problem?

The problem is that meta files of deleted directories persistently reappear as new files in Git client, no matter how many times they are removed.

Here is a scenario. On one computer, a directory is deleted and the change is committed to Git. On another computer that has synced with Git, a meta file that is corresponding to the deleted directory, appears as a new file in Git client. Deleting the meta file won’t fix the problem. When Unity editor is launched or gains focus, the meta file is back.


Unity maintains a meta file for every directory. Even an empty directory has a meta file. Whenever it sees a directory without a meta file, it creates one. Git tracks files, not directories. When a directory is deleted in Unity on one computer, its meta file is deleted, too. Git then remembers that the file does not exist and makes other computers remove it when they sync. However, the directory is not removed, because Git does not track directories. When Unity editor is launched or gains focus, it creates a meta file for the directory, hence the problem.


Idea++ provides a free solution to address the situation: Empty Directories Remover. It is licensed under MIT license.

How does Empty Directories Remover work?

Empty Directories Remover monitors Unity projects for deletions and movements of files and directories. Whenever a deletion or a movement happens, it checks the directories involved and remove any empty directory found.


– Fully automated. It is seamlessly integrated with Unity editor and works without any human intervention.

– Lightning fast. Instead of scanning the whole project, Empty Directories Remover checks only the directories involved in deletions or movements. This makes it extremely efficient.


The source code can be found here.

How to use?

Save EmptyDirectoriesRemover.cs to any Editor directory and it is done.


Subscribe to our newsletter for new releases of free solutions.