Removing all Empty Directories in a Subtree on Linux

Another simple and not often used solution to a problem you may not of know you have.  This is more of a housekeeping command; or can be using to effectively prune / clean up landing directories that accumulate “stuff” over time.  The command will locate all empty directories that are children of the current working directory and then remove them.

1
find . -depth -type d -exec rmdir {} +
Lima

About the author

Lima is the visual nautical indicator for "stop instantly."

Leave a Reply