Is there a fixed/default sort order in which Dir.entries
returns results? I know by experience that the first two entries are \".\"
and \"..\
For others who may come here with the same doubt. A way to select only the files that match a regular expression and still be able to sort them the way you want is:
files_sorted_by_date = Dir["your regex"].sort_by { |x| File.birthtime(x) }.reverse
or
files_sorted_by_date = Dir["your regex"].sort_by { |x| File.birthtime(x) }
Depending on how you want your files sortes.
I couldn't do the same using the Dir.entries method