Locate Empty Directories from Command Line

As a software engineer that lives too much of his life on a computer, I like keeping my machine as clean as possible. I don’t keep rogue downloaded files and removes apps when I don’t need them. Part of keeping a clean, performant system is removing empty directories.

To identify empty directories, I use the following command:

 find . -type d --empty 

To remove empty directories, we can add a --delete flag:

 find . -type d --empty --delete 

Keeping a clean machine is easy when you know the tools that can help you. find makes identifying and eliminating easy, so don’t be afraid to use it!

The post Locate Empty Directories from Command Line appeared first on David Walsh Blog.

David Walsh Blog

Posted in: JavaScript

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.