Does readdir() guarantee an order?

The readdir method doesn’t guarantee any ordering. If you want to ensure they are sorted alphabetically you’ll need to do so yourself.

Note: I searched for a bit for definitive documentation saying this is the case. The closest I came is the following link

  • http://utcc.utoronto.ca/~cks/space/blog/unix/ReaddirOrder

It’s by no means definitive but it does give a nice overview of the command, its history and how its implementation is typically traversal order.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)