Nothing out of the ordinary was going on. You get them in the order they were added to that directory. I'm very sure that maverick is wrong here, as well.
On Unix-ish filesystems, a file is a nameless entity identified by its inode number. A directory is a file that maps filenames to inode numbers. Because you can map many filenames to the same inode, in the same or across different directories, and because inodes of deleted files are recycled, the inode number, creation order and directory order of files have no relation to one another.
For all intents and purposes, the list you get from readdir is in random order. If you need it in a particular one, you have to enforce it youself, as you did in that example.Makeshifts last the longest.
In reply to Re: What order do my files come from readdir() in?
by Aristotle
in thread What order do my files come from readdir() in?
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |