From: Robert Klemme Date: 2008-10-31T17:13:32+09:00 Subject: Re: how to sort this array And here's a variant for cases where there are multiple subdirectories: irb(main):010:0> puts files.sort_by {|f| f.scan(/\d+/).map{|x|x.to_i}} c:/ruby/self/2004/1.txt c:/ruby/self/2004/2.txt c:/ruby/self/2004/3.txt c:/ruby/self/2004/10.txt c:/ruby/self/2004/20.txt Kind regards robert -- remember.guy do |as, often| as.you_can - without end