Finding Empty Directories With Bash

Needed to find some empty directories today, so I ran a google search and found this excellent example of using find to locate (and delete) empty directories.

find -depth -type d -empty -exec rmdir {} \;

Actually, all I wanted was this:

find -depth -type d -empty

Parameters are as follows:

-depth — start at the deepest point
-type d — limit to directories
-empty — find empty directories

Related posts:

  1. Bash Tutorial

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>