//View Tip #496
Similar Tips
» Delete old files
» Rename many files using find and perl
» Find and replace on specific files
» Using comm
» Duplicate directory tree

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Remove all empty directories within the current directory

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

Or another way to do it: perl -MFile::Find -e"finddepth(sub{rmdir},'.')"


View Comments »




Comments 

Add your comment

Comments are currently disabled
Gnu Find version 4.4.0 supports a -delete option so that could also be rewritten as:

find . -type d -empty -delete
Posted 2009-01-27 16:44:00
Octavio
How about

rmdir -- *
Posted 2009-01-27 18:06:59

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit