Sort order in `Dir.entries`

前端 未结 4 2043
逝去的感伤
逝去的感伤 2020-12-03 07:33

Is there a fixed/default sort order in which Dir.entries returns results? I know by experience that the first two entries are \".\" and \"..\

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 08:07

    I think there is no default sort order, but you can use Dir.entries('some_path_to_dir').sort to sort them in ASC way.

提交回复
热议问题