Neil Conway <nconway / klamath.dyndns.org> writes: > I'm still a Ruby-newbie, so if this is silly, just tell me. What's odd is that there was recently a thread in c.l.perl.misc about the very same topic. Proof that your concern is not Ruby-specific! > The problem with this is that Dir#each includes "." (and ".."). However, this is a feature of the operating system, not of Ruby per se. > To avoid this, I suppose I'd need to do some checking for special > cases, and ignore "." and ".." -- except this seems kinda clumsy to > me. I think that another method for Dir would be justified: like > #each, except it doesn't include "." and ".." It's so easy to check for those cases, that to do something so non-orthogonal [does "orthogonal" have an antonym?] seems, IMHO, unjustifiable. You're already checking for files that don't exist... Just add return unless file =~ /^\.\.?$/ # skip current and parent dirs > Call it Dir#all_files or something... But . and .. *are* files. :) -- Jonathan Feinberg jdf / pobox.com Sunny Brooklyn, NY http://pobox.com/~jdf