Unix tip: Recursively removing empty directories
Recursively removing empty directories from a file system might seem like a lot of work. How do you find all the directories and how do you determine programmatically which of them are empty? But let's look at how this task can be made very easy by taking advantage of the normal behavior of the rmdir command.
View full article »
Esther Schindler
If the comments are ugly, the code is ugly
claird
SVG a graphics format for 21st century
pasmith
Take Chrome OS for a test spin
Sandra Henry-Stocker
Solaris Tip: Have Your Files Changed Since Installation?
jfruh
Android fragments vs. the iPhone monolith
mikelgan
What Gizmodo missed about the Pro WX Wireless USB disk drive
Sidekick: The Good News & the Bad News
Either way you look at it Microsoft Data Center management did not follow standards or best practices in this failure. In which case it makes me wonder more about the outsourcing of corporate data much less personal data.
- mburton325
Join the conversation here
Quick, practical advice for IT pros. Made fresh daily.
Want to cash in on your IT savvy? Send your tip to tips@itworld.com. If we post it, we'll send you a $25 Amazon e-gift card.













Or just use the "-depth" option on find
The -depth option makes "find" search sub-directories first. This should do it:find . -type d -depth -print | xargs rmdir
With GNU find, it's even easier
In addition to the -depth switch, systems using Gnu find have an -empty switch that matches on empty files or directories. Your command can be shortened to:find . -depth -type d -empty | xargs ...
I've looked in some older versions of the Gnu findutils package and it's been there some time now.