a question for you shell scripters

Jason Clinton clintonj at umkc.edu
Wed Mar 26 15:21:47 CST 2003


How can I rmdir all subdirectories that have no files in them,
recursively. For instance: I have a music directory with artist
subdirectories with album directories beneath that. Over the course of
time, I have asked XMMS to delete a song I'm tired of hearing. I've
found that there are not artists that I have no songs remaining for so
their entire directory structure is just a bunch of empty folders.

I came up with this newbish solution:

# rmdir */*
# rmdir *

This works fine (since rmdir will only delete empty stuff) from the
music directory and if I don't have lots of subdirectories, but I'm
wondering what the /right/ way to do it is.

--
Jason Clinton
I don't believe in witty sigs.





More information about the Kclug mailing list