From: Adam Prescott Date: 2011-03-03T10:05:57+09:00 Subject: Re: Finding all empty directories in a subversion checkout --90e6ba5bb8d97e57f3049d89996c Content-Type: text/plain; charset=UTF-8 On Thu, Mar 3, 2011 at 12:15 AM, Markus Fischer wrote: > dirs_count[dir] = > Dir.entries(dir).collect { |e| > case e > when '.svn' > nil > when '.' > nil > when '..' > nil > else > e > end > }.compact.count > Instead of mapping values to nil and using compact, you can simply use Enumerable#reject or #select. For this, though, since I think you can rely on Dir.entries(dir).sort having "." and ".." as the first two entries, you could get away with this: Dir.entries(dir)[2..-1].reject { |e| e == ".svn" } --90e6ba5bb8d97e57f3049d89996c--