From: Nathan Powell Date: 2008-08-19T02:42:37+09:00 Subject: Re: Need ruby code to get a latest file from a Directory On Tue, Aug 19, 2008 at 02:23:07AM +0900, Rajeswar reddy Gaulla wrote: > I am having log files with time stamp in a log directory, how to open a > latest log file and read it?. Dir.entries('.').sort_by {|f| File.mtime(f)}.reverse[0] Does that do what you want? -- nathan nathan_at_nathanpowell_dot_org If all else fails, immortality can always be assured by spectacular error. ~ John Kenneth Galbraith ------------------------------------