From: Markus Fischer Date: 2011-03-03T09:15:00+09:00 Subject: Finding all empty directories in a subversion checkout Hi, I tried to write a script to find all empty directories in a subversion checkout. In my view there were two main problems to solve: 1) empty directories also contain .svn control directories 2) directories containing only further empty directories should be detected as such too. I came up with https://gist.github.com/852051 and on my simple tests so far it worked well. I'd like to get feedback on the code and how I used certain idioms, or rather, miss-used certain idioms or areas where I can improve it "the ruby way". For example, I'm not really fond of the big case statement in the fourth loop block: dirs_count[dir] = Dir.entries(dir).collect { |e| case e when '.svn' nil when '.' nil when '..' nil else e end }.compact.count Seems pretty redundant to me, in other languages I'd have written e.g. switch(e) { case '.svn': case '.': case '..': return nil; default: return e; } But I'm not sure how to apply that in ruby and I also think that these could be improved anyway. I'm sure a trained mind can spot other areas for improvement, I'm glad for any suggestions! thanks, - Markus