Remove Deeply Nested Empty Folders On Linux

Over time my media server can become cluttered with empty folders deeply nested on my file system. I will show you how to take care of them with a simple command.

The command below traverses all directories in a subtree and deletes the empty ones. Hope this helps you clean all your pesky empty folders.

find . -type d -empty -delete
  • -type d restricts to directories
  • -empty restricts to empty ones
  • -delete removes each directory

No Comments, Be The First!

Your email address will not be published.