Check For Empty Directories Using ‘find’ Shell Command

find /path/to/directory -type d -empty -exec echo {} ;

I think it’s easy to get the idea based on the example above, but just in case you need inspiration, you could automatically remove these empty directories with the following (Careful! This uses ‘-rf’ flag which shows no warnings or mercy!):

find /path/to/directory -type d -empty -exec rm -rf {} ;

Check out some additional methods here:

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:

There's 0 Comment So Far

Share your thoughts, leave a comment!