Unity Card Posted July 17, 2006 Posted July 17, 2006 Is it possible to use AutoIt to look at all the files in a folder and assigning the file name with the oldest date to a variable? Please let me know as I couldn't find anything that would help...thank you!
Xenobiologist Posted July 17, 2006 Posted July 17, 2006 Is it possible to use AutoIt to look at all the files in a folder and assigning the file name with the oldest date to a variable?Please let me know as I couldn't find anything that would help...thank you!Hi,I dunno what you exactly want to do, but until the word folder Ican say yes that is possible. So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Helge Posted July 17, 2006 Posted July 17, 2006 $hSearch = FileFindFirstFile("*.*") If $hSearch = -1 Then MsgBox(16, "FileFindFirstFile", "An error occured !") Exit EndIf $sOldFile = "" $iOldTime = 0 While 1 $sCheckFile = FileFindNextFile($hSearch) If @error Then ExitLoop $iCheckTime = FileGetTime($sCheckFile, 1, 1) If $iOldTime = 0 OR $iCheckTime < $iOldTime Then $sOldFile = $sCheckFile $iOldTime = $iCheckTime EndIf WEnd If $sOldFile = "" Then MsgBox(16, "Failure", "Failed to find the oldest file.") Else MsgBox(64, "Success", "File : " & $sOldFile & @CRLF & "Time : " & $iOldTime) EndIfCurrently is gives you the oldes created file, but if you instead want theaccess- or modified-time then just change the second parameter in FileGetTime.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now