LLBBL

5 words

Remove Empty Dirs

September13

This will remove empty directories on any *nix based OS. Of course you have to sudo the command or run it as root depending on how things are configured.

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

The following code will dump it to a list first, then you can review the list and count the number of lines before deleting the empty dirs.

find -depth -type d -empty > list_for_review
cat list_for_review | wc -l
find -depth -type d -empty -exec rmdir {} \;

If you just want to count the number of empty dirs use the following command.

find -depth -type d -empty | wc -l

Have fun removing dirs. :D

posted under News

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Email will not be published

Website example

Your Comment: