Created
September 20, 2013 00:28
-
-
Save rajsahae/6631781 to your computer and use it in GitHub Desktop.
Finding empty directiories in bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for dir in `find . -type d | tail -n +2`; do | |
[ "`find $dir -type f | wc -l`" -eq "0" ] && echo "$dir is empty" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I also used:
find . -type d -empty -delete
That seems to be way better.