Skip to main content


I updated a Linux distribution to a beta release recently, resulting in some empty directories being left in the file system. Unfortunately, as I found out, Erlang (used by Pleroma) was searching in the empty directories for various modules, and failing to find them, leading to fatal runtime errors.
The solution: "find -maxdepth 1 -type d -empty -delete", to remove all of the empty directories one level below the current directory.
Having solved the problem myself, I then queried GPT-4, as I was interested to know whether it could give a correct solution. Indeed it could, although the GPT-4 solution was unnecessarily more complex than mine, with an -exec option used to run rmdir on each directory. I did specify that I was using Linux, so GNU extensions to the find command would have been allowed in the answer.
#CommandLine #Linux