question, I need to locate a file which is created the same minute or just 1 minute earlier /later.
I know where the "same" file is located so that all is no issue
So I just want to compare all files in that folder till I have found the right file.
So file array contains a listing of all the files in the folder I am searching:
fileArr(0,x) contains the filename
fileArr(1,x) contains the datemodified of the file
Function FindJobFile(date_time)
for x = 0 to IntFileArrSize - 1
if ABS(DateDiff("N",date_time,FileArr(1,x))) < 2 then
FindJobFile = FileArr(0,x)
exit for
End If
Next
End Function
now my question is : what happens if the timedifference is too big ?
I don't know if datediff output is a integer or a Longint, but the list I am looking in could contain hundreds or a few thousand files of which the first ones maybe 3 years older than the one I am trying to locate. however the datelastmodified is the only link I can make so I have to scan for this time difference.
or would it be better to nest the checks, and first check if the year is the same, than the month, than the day and as last step the datediff statement above ?
I know where the "same" file is located so that all is no issue
So I just want to compare all files in that folder till I have found the right file.
So file array contains a listing of all the files in the folder I am searching:
fileArr(0,x) contains the filename
fileArr(1,x) contains the datemodified of the file
Function FindJobFile(date_time)
for x = 0 to IntFileArrSize - 1
if ABS(DateDiff("N",date_time,FileArr(1,x))) < 2 then
FindJobFile = FileArr(0,x)
exit for
End If
Next
End Function
now my question is : what happens if the timedifference is too big ?
I don't know if datediff output is a integer or a Longint, but the list I am looking in could contain hundreds or a few thousand files of which the first ones maybe 3 years older than the one I am trying to locate. however the datelastmodified is the only link I can make so I have to scan for this time difference.
or would it be better to nest the checks, and first check if the year is the same, than the month, than the day and as last step the datediff statement above ?