Jump to content

what is the best way to compare files


Recommended Posts

What i am trying to do is compare date of destination and source, and if source file is newer than destination it copies the file to source.

Just posting a sample code of what i am trying to achieve

 

#include <Date.au3> ; Include Date constants
#include <File.au3>
#include <iNet.au3>
#include <_XMLDomWrapper.au3>


Global $xml1, $xml1monthday, $xml1year, $xml1format, $xml2, $xml2monthday, $xml2year, $xml2format, $xmldate

; Runs the XmlDate() function to determine the age of the Xml file
;=====================================================================
XmlDate()

Func XmlDate()
$Xml1 = RegRead("C:\Temp\m1.xml","XmlDate") ; pulls registry

$xml1monthday = StringTrimRight($xml1, 5) ; takes the month

$xml1year = StringTrimLeft($xml1, 6) ; takes the year out

$xml1format = ($xml1monthday & "/" & $xml1year) ; reorders the date

$Xml2 = RegRead("C:\Temp\m2.xml","XmlDate") ; pulls registry

$xml2monthday = StringTrimRight($xml2, 5) ; takes the month and

$xml2year = StringTrimLeft($xml2, 6) ; takes the year out

$xml2format = ($xml2monthday & "/" & $xml2year) ; reorders

if $Xml1 = "" And $Xml2 = "" Then
   FileCopy( "C:\temp\a1.txt", "C:\temp\anokh", 1);
Else
   FileDelete("c:\temp\a1/txt")
   EndIf
EndFunc

 

 

Any comments will be appreciated 

Thank you

Link to comment
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
 Share

×
×
  • Create New...