Jump to content
Sign in to follow this  
d0n

getting most recent created file

Recommended Posts

d0n

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]
            EndIf
        EndIf
    Next
Edited by d0n

Share this post


Link to post
Share on other sites
kaotkbliss

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

Thank you.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.