Compare 2 files
-
- Posts: 5
- Joined: Fri Jan 05, 2007 5:35 am
Compare 2 files
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
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.
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.
-
- Posts: 5
- Joined: Fri Jan 05, 2007 5:35 am
Compare 2 files
Excellent thanks for the reply. I was able to get this to work! Thanks again!