I have a routine which scans a directory looking for TXT files ready for parsing.
How can I ensure that the files are read in a certain sequence?
If the filenames are generated sequentially:
file1.txt 10:14 21-May
file2.txt 10:17 21-May
file3.txt 10:20 21-May
Then they are read in the correct order.
However, If one of the files is written before the others:
file2.txt 10:17 21-May
file1.txt 10:14 21-May
file3.txt 10:20 21-May
Then fileseek() will not read file2 before file1 and this causes problems.
How can I ensure that the files are all read sequentially from 1 to 3? Is this just a matter of loading the file directory into an array and sorting? Or is there an option in fileseek to presort the dir before scanning it?
How can I ensure that the files are read in a certain sequence?
If the filenames are generated sequentially:
file1.txt 10:14 21-May
file2.txt 10:17 21-May
file3.txt 10:20 21-May
Then they are read in the correct order.
However, If one of the files is written before the others:
file2.txt 10:17 21-May
file1.txt 10:14 21-May
file3.txt 10:20 21-May
Then fileseek() will not read file2 before file1 and this causes problems.
How can I ensure that the files are all read sequentially from 1 to 3? Is this just a matter of loading the file directory into an array and sorting? Or is there an option in fileseek to presort the dir before scanning it?