ijourneaux 1 Posted August 18, 2010 I have a folder where there are several files I need to process. Files get added on a continuous basis. I have been using FileFindFirstFile and FileFindNextFile successfully for a while now but ran into a situation where It would be much better to process the files oldest first. Is there a way to control FileFindNextFile so that it returns the oldest file instead of the first file alphebetically? Any thoughts on a different approach get process the files oldest first? Share this post Link to post Share on other sites
boogieoompa 0 Posted August 19, 2010 Store them in an array and the FileGetTime attribute. Once you store them in an array you reference it via the array number +1 or -1 instead of the FileFindNextFile. You will also have to use the _ArraySort UDF given in the help file. Share this post Link to post Share on other sites
ijourneaux 1 Posted August 23, 2010 Thanks for the tips. Here is the solution I came up with. $FileList=_FileListToArray($Folder, "*." & $extension) $err = @error If (@Error=4) Then $filename = "" Else $UBound = UBound($Filelist)-1 Dim $CombinedArray[$UBound][2] for $i=1 to $Ubound $datetime = FileGetTime($folder & "\" & $FileList[$i], 0, 1) $CombinedArray[$i-1][0] = $FileList[$i] $CombinedArray[$i-1][1] = $datetime Next _ArraySort($CombinedArray, 0, 0, 0, 1) $filename = $CombinedArray[0][0] endif Share this post Link to post Share on other sites