I have a开发者_StackOverflow中文版n array of filenames, is there any way to sort these files by modification date?
You can use the sort_by method in conjunction with File.mtime method, which returns the last modification time of the given file.
filenames.sort_by {|filename| File.mtime(filename) }
加载中,请稍侯......
精彩评论