//View Tip #496
Similar Tips
» Mass-renaming files
» Duplicate directory tree
» Directory Tree
» Pipe files to an archive
» Replace expr by other recursively


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 »


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
How about

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

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit