Jump to content
Sign in to follow this  

getting most recent created file

Recommended Posts


what would be the best way to get the most recent created file

should i use _FilelisttoArray and do a FileGetTime in a loop? or is there a better way to accomplish this?

so far i have this, which works but think there is a better way to do it

$Log = _FileListToArray(@ScriptDir&"\Date")
    $yyyymmdd1 = 0
    $yyyymmdd2 = 0
    For $i = 1 to $Log[0]
        $aTime = FileGetTime(@ScriptDir&"\Date\"&$Log[$i], 1)
        If Not @error Then
            $yyyymmdd1 = $aTime[0] & $aTime[1] & $aTime[2]
            If $yyyymmdd1 > $yyyymmdd2 Then
                $yyyymmdd2 = $yyyymmdd1
                $Recent = $Log[$i]
Edited by d0n

Share this post

Link to post
Share on other sites

I don't know if you found what you were looking for, but you helped me get what I needed...

Thank you.



My Android cat and mouse game

We're gonna need another Timmy!

Share this post

Link to post
Share on other sites

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
Sign in to follow this