From: zuerrong Date: 2011-01-08T18:45:41+09:00 Subject: Re: file list sorted by creation date Or use a Swatz* Transform which is used by sort_by inherently: Dir.entries(".").map{|c| [c,File.stat(c).ctime]}.sort{|a,b| a[1]<=>b[1]}.map{|d| d[0]} * Swatz is a Perl hacker whose full name is Randal Swatz (hope me remember that correctly). 2011/1/8 zuerrong : > 2011/1/8 Rajarshi Chakravarty : >> Hi, >> I need to get a list of all files in a directory sorted by their >> date/time of creation. > > sort_by it: > > Dir.entries(".").sort_by{|c| File.stat(c).ctime} >