From: Dave Thomas Date: 2000-12-09T14:18:04+09:00 Subject: [ruby-talk:6951] Re: Dir.sort(somedir) ? Dave Brondsema writes: > Dir.foreach(thisdir) { > |filename| > # do stuff with filename > } > > How can I change this so that it iterates through the alphabetically > sorted directory? You could try something like Dir.new(thisdir).sort.each do |file| .,, end While Dir.foreach is a class method, Dir.new creates a new directory object. Directory objects have all the Enumerable methods, so sort is available. Regards Dave