NextFile() in alphabetic order on linux
BlitzMax Forums/BlitzMax Beginners Area/NextFile() in alphabetic order on linux
| ||
Hi, If I iterate over the files of a directory eg. [˘odebox] SuperStrict Framework brl.standardio Import brl.filesystem Local dir:int = ReadDir("/") local file$ Repeat file$= NextFile(dir) DebugLog file Until file= "" [/codebox] They appear in alphabetic order on windows but not on linux. Can this be achieved without first saving every file eg. to a list and afterwards sorting the list and then iterate over the list elements again? Would be nice if there were a paramete to get the files sorted already... |
| ||
Note that the sort order isn't always alphabetical under Windows either, it depends on the filesystem. If I look at a mapped network drive on my (Linux) NAS, the files are returned in non-alphabetical order in windows Explorer as well. |
| ||
You will certainly reach a system-file-amount-limit (FAT32 can only hold 65.000 files per directory) before experiencing a tlist-sort-lag. Just fetch all files in a list, sort it and voila... (that is the way I am doing it - working on directories with multiple thousands of files). bye Ron |
| ||
Well then. A list it is. |