Is there a fixed/default sort order in which Dir.entries returns results? I know by experience that the first two entries are "." and "..".
Is there a fixed/default sort order in which Dir.entries returns results? I know by
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
According to the Ruby language docs,
Dir.entries()does not guarantee any particular order of the listed files, so if you require some order it’s best to do it explicitly yourself.For example, if you need to sort by file modification time (oldest to newest), you could do the following: