This post shares a small (but useful) recipe for getting rid of empty folders in Unity. This annoying thing usually happens when you switch between different git branches, since different branches may add/remove folders.
Git doesn’t like to deal with empty folders, it doesn’t let you delete those empty folders… In case you’ll delete the .meta files, Unity will re-create those later (since the folders still exist).
Show me the code
The code is available in this link: Remove empty folders
Add the class into an editor folder in your project. It will add a new menu item (under Tools/Remove empty folders) that will allow you to remove empty folders.
NOTE: the code contains a dryRun flag that will only iterate and list all the empty folders it’s going to remove. Change this to false to actually make the code delete anything 🙂