rasim Posted December 29, 2007 Share Posted December 29, 2007 Hello! How can compare two files for know what file is newest? I make below script: #include <Date.au3> $FileTime1 = FileGetTime(@ProgramFilesDir & "\Eset\updfiles\upd.ver") $FileTime2 = FileGetTime("f:\base\updfiles\upd.ver") $FullDate1 = DateFormat($FileTime1, "/") $FullDate2 = DateFormat($FileTime2, "/") If _DateDiff("n", $FullDate1, $FullDate2) < 1 Then MsgBox(0, "", "File " & @ProgramFilesDir & "\Eset\updfiles\upd.ver newest than f:\base\updfiles\upd.ver") EndIf Func DateFormat($sTimeArray, $Delim = "/") Local $retTime For $i = 0 To UBound($sTimeArray) -1 If $i = 2 Then $retTime &= $sTimeArray[$i] & " " $Delim = ":" Else $retTime &= $sTimeArray[$i] & $Delim EndIf Next Return StringTrimRight($retTime, 1) EndFunc but mayb someone have other nice variant? Thanks! Link to comment Share on other sites More sharing options...
randallc Posted December 29, 2007 Share Posted December 29, 2007 Hi, Maybe easier?.. ; getnewest.au3 #include <Date.au3> $sFile1=@ScriptDir&"\array.au3" $sFile2=@ProgramFilesDir&"\AutoIt3\Include\array.au3" $FileTime1 = FileGetTime($sFile1, 0, 1) $FileTime2 = FileGetTime($sFile2, 0, 1) If $FileTime1>$FileTime2 Then MsgBox(0, "", "File " & $sFile1&" newest than "&$sFile2&@LF&"File " & $FileTime1&" newest than "&$FileTime2&@LF) EndIf best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
rasim Posted December 29, 2007 Author Share Posted December 29, 2007 Hi, Maybe easier?.. ; getnewest.au3 #include <Date.au3> $sFile1=@ScriptDir&"\array.au3" $sFile2=@ProgramFilesDir&"\AutoIt3\Include\array.au3" $FileTime1 = FileGetTime($sFile1, 0, 1) $FileTime2 = FileGetTime($sFile2, 0, 1) If $FileTime1>$FileTime2 Then MsgBox(0, "", "File " & $sFile1&" newest than "&$sFile2&@LF&"File " & $FileTime1&" newest than "&$FileTime2&@LF) EndIf best, Randall What? This is work correct? Are you sure? P.S. If your solution works correct, that is nice and easy variant Link to comment Share on other sites More sharing options...
dams000 Posted July 10, 2008 Share Posted July 10, 2008 Thanks. Link to comment Share on other sites More sharing options...
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