Jump to content

comparison of files to verify data


Recommended Posts

Hello everyone,

I am brand new to autoit and I am trying add a line after a file copy script that does a comparison of the files that are in each directory to verify that the data copied correctly.

Here is my file copy script:

FileCopy, ("C:\Source Test", "C:\Dest Test")

thanks

Link to comment
Share on other sites

...I am trying add a line after a file copy script that does a comparison of the files that are in each directory to verify that the data copied correctly...

Welcome to the forum.

I could be wrong, but I do not think that such a verification can be accomplished within AutoIt using only one line of code; however, a one line text file can make the file copy and verify the copy - enter xcopy /? at a command prompt and follow the help instructions.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Hello everyone,

I am brand new to autoit and I am trying add a line after a file copy script that does a comparison of the files that are in each directory to verify that the data copied correctly.

Here is my file copy script:

FileCopy, ("C:\Source Test", "C:\Dest Test")

thanks

First you have a stray comma that makes this code invalid...

Next, FileCopy() gives a return code to indicate if anything went wrong. From the help file:

Return Value

Success: Returns 1.

Failure: Returns 0.

If FileCopy() returns 1, why go looking for a compare?

If you don't want it to overwrite a possibly existing file, or something, then try:

$File1 = FileGetShortName("C:\Source Test")
$File2 = FileGetShortName("C:\Dest Test")
$RET = RunWait(@ComSpec & ' /c FC /B ' & $File1 & " " & $File2, @TempDir, @SW_HIDE)
If Not $RET Then
    MsgBox(64, "Match", "File comapre matched")
Else
    MsgBox(16, "Error", "File compare did not match")
EndIf
Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

First you have a stray comma that makes this code invalid...

Next, FileCopy() gives a return code to indicate if anything went wrong. From the help file:

If FileCopy() returns 1, why go looking for a compare?

If you don't want it to overwrite a possibly existing file, or something, then try:

$File1 = FileGetShortName("C:\Source Test")
$File2 = FileGetShortName("C:\Dest Test")
$RET = RunWait(@ComSpec & ' /c FC /B ' & $File1 & " " & $File2, @TempDir, @SW_HIDE)
If Not $RET Then
    MsgBox(64, "Match", "File comapre matched")
Else
    MsgBox(16, "Error", "File compare did not match")
EndIfoÝ÷ ØGbµ;«çb¶)í¡§îËb¢wè­æ¬êî±æ®¶­sdbôfÆT6ö×&RgV÷C´3¢b3#µ6÷W&6RFW7BgV÷C²ÂgV÷C´3¢b3#´FW7BFW7BgV÷C²FVà ×6t&÷cBÂgV÷C´vööBgV÷C²ÂgV÷C´fÆW2ÖF6VBâgV÷C²¤VÇ6P ×6t&÷bÂgV÷C´&BgV÷C²ÂgV÷C´fÆR6ö×&RfÆVBÂW'&÷"ÒgV÷C²fײW'&÷"fײgV÷C²WFVæFVBÒgV÷C²fײWFVæFVB¤VæD`£²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒУ²gVæ7FöâôfÆT6ö×&Rb33c·4fÆSÂb33c·4fÆS"£²W&f÷&×2&æ'fÆR6ö×&RöbGvòfÆW0£²&WGW&âf÷"ÖF6ࣲ&WGW&ç2æB6WG2W'&÷"f÷"fÇW&S £²W'&÷"ÒÒfÆR6ö×&RfÆVBÂWFVæFVBÒTU%$õ$ÄUdTÂRg&öÒDõ2d26öÖÖæ@£²W'&÷"Ò"ÒçfÆBfÆR2£²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒФgVæ2ôfÆT6ö×&Rb33c·4fÆSÂb33c·4fÆS" bfÆTW7G2b33c·4fÆSÒ÷"fÆTW7G2b33c·4fÆS"ÒFVâ&WGW&â6WDW'&÷"" b33c·4fÆSÒfÆTvWE6÷'DæÖRb33c·4fÆS b33c·4fÆS"ÒfÆTvWE6÷'DæÖRb33c·4fÆS" b33cµ$UBÒ'VåvB6öÕ7V2fײb33²ö2d2ô"b33²fײb33c·4fÆSfײgV÷C²gV÷C²fײb33c·4fÆS"ÂFV×F"Â5uôDR bæ÷Bb33cµ$UBFVà &WGW&â VÇ6P &WGW&â6WDW'&÷"Âb33cµ$UB VæD`¤VæDgVæ
I didnt think there was such a command as _Filecompare in Autoit.
Link to comment
Share on other sites

I didnt think there was such a command as _Filecompare in Autoit.

Well there is NOW!

:)

All seriousness aside, there are REAL programmers on this forum, and my little UDF can probably be replaced with a REAL function. Till then, it works for me.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Well there is NOW!

:)

All seriousness aside, there are REAL programmers on this forum, and my little UDF can probably be replaced with a REAL function. Till then, it works for me.

:D

what about generating a file which lists the difference between two files , if they dont

match ?

Link to comment
Share on other sites

what about generating a file which lists the difference between two files , if they dont

match ?

You can get that, but you need to script the FC.exe command more directly. Open a commandline and try "FC /?" to see what's there. That function I posted was a simple for a binary match because that's what mdcotter30 seemed to ask for.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...