Delete empty directories

Over the years, my music collection has moved from one drive to another to another and so on. Unfortunately, I’ve lost some data through my own poor copy methods. This has left me with a lot of empty directories. Cleaning these out when you have more than 200 directories to pick through can be rather tedious.  Thank goodness for find! Use the following to clean out your empty directories.

find ~/dir -empty -type d -exec rmdir ‘{}’ ‘;’

Leave a Reply

You must be logged in to post a comment.