Jump to content

Recommended Posts

Posted

ahhh actually I was reading max already. I thought I can use the same algorithm.

Actually I wanted to compare dates using FileFindFirstFile and pull out the latest date.

:)

Posted

$search = FileFindFirstFile("*.txt")
    If $search= -1 Then Return
    Dim $file
    While 1
        $file = FileFindNextFile($search)
        If @error Then ExitLoop
                WEnd
    
    FileClose($search)

How do I put $file into an array ?

Posted

$search = FileFindFirstFile("*.txt")
     If $search= -1 Then Return
     Dim $file
     While 1
         $file = FileFindNextFile($search)
         If @error Then ExitLoop
                 WEnd
     
     FileClose($search)

How do I put $file into an array ?

You need _FileListToArray.

Then for each file in the earray you can use FileGetTime to find the time the file was last modified, and you can use _DateDiff to see which of two dates is more recent.

To find the newest file you don't need an array at all; you can use FileFindNext as you already were and compare with the newest found so far.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

You need _FileListToArray.

Then for each file in the earray you can use FileGetTime to find the time the file was last modified, and you can use _DateDiff to see which of two dates is more recent.

To find the newest file you don't need an array at all; you can use FileFindNext as you already were and compare with the newest found so far.

That's also a good solution, perhaps more hardware friendly too (spreads out the load more)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...