Page 1 of 1
Compare 2 files
Posted: Mon Mar 31, 2008 1:54 pm
by rolltidega
I have a script that runs on 2 different servers that creates a text file on each server. I need to be able to compare the contents of both files to see if they contain the same content. If the content is identical, I want it to e-mail me a successful result. If the content is different, I want it to e-mail me an unsuccessful result. I know how to do the e-mail piece in Robotask, I just do not know how to compare the 2 files for identical content. Thanks for any help!
Compare 2 files
Posted: Tue Apr 01, 2008 12:01 am
by Oleg
You may compare two text files by FC.exe system utility.
This tool can compare text or binary files.
for example:
fc "c:\file1.txt" "c:\file2.txt"
for more options run this:
fc /?
In order to get a result as a text you may redirect output stream into file do the following
fc "c:\file1.txt" "c:\file2.txt" > c:\result.txt
In this case results will be written into c:\result.txt file
But you have to use command interpreter in "Run Program/Opnen Document" action in order to get this work properly.
Full command line will look so:
cmd /c fc "c:\file1.txt" "c:\file2.txt" > c:\result.txt
Input CMD into 'Program or document name' field and rest of string (/c fc "c:\file1.txt" "c:\file2.txt" > c:\result.txt) into parameters
Next, you can mail result.txt anywhere.
Compare 2 files
Posted: Tue Apr 01, 2008 4:34 am
by rolltidega
Excellent thanks for the reply. I was able to get this to work! Thanks again!