for i = myFolder.Count downto 1
myFile = myFolder.TrueItem(i)
will go through the myFile in myFolder alphabetically.
myFolder has a variety of files, several of which have, as part of their names, an sqldate, (something like 1954-05-17), as the fourth nthField(" "),
e.g… if myFile.name = “XY John Doe 1954-05-17”, NthField(myFile, " ", 4) would be 1954-05-17
Is there a way to go through the folder items via the sqldate in descending order (earliest date first)?
go 1 to count - its slow to go backwards
you’d be better off to get a list of all folder items and put their creation or modification dates in another array
then use sort with then go though the array of folder items
di[code]m items() as folderitem
dim dates() as double // we’re gong to use total seconds from the creation date
for i = 1 to myFolder.Count
items.append myFolder.TrueItem(i)
dates.append myFolder.TrueItem(i).creationdate.totalseconds
next
dates.sortwith items
for i = 0 to ubound(items)
// do whatever with this item
next[/code]
If you go peek at my code again you’ll see I grab the folderitem and whatever attribute it is I want to sort them by
Then use “sortwith” to order both arrays by that and go through the folder items