# Thread: how to compare multiple files?

1. Visitor
Join Date
Jun 2013
Posts
4

## how to compare multiple files?

hi,

I dont have much exp with BC 3 and scripting, i would like to build script to compare four files for example:

scenario1:
file 1: \\server1\folder1\text.txt
file 2: \\server2\folder1\text.txt

scenario2:
file 3: \\server3\folder1\text.txt
file 4: \\server4\folder1\text.txt

ofc, I would like to have these two comparisons done in the same time.

2. Team Scooter
Join Date
Oct 2007
Location
Posts
11,375
Hello,

Would you like to generate a report comparing file1 to file2, then generate a 2nd report comparing file3 to file4?

This can be done in scripting using the command line:
bcompare.exe "@c:\bcscript.txt"

Then the script file example could be:
[CODE]
text-report layout:side-by-side output-to:"c:bcreport1.html" output-options:html-color "\\server1\folder1\text.txt" "\\server2\folder1\text.txt"
text-report layout:side-by-side output-to:"c:bcreport2.html" output-options:html-color "\\server3\folder1\text.txt" "\\server4\folder1\text.txt"

Scripting actions follow the general actions you can perform in the graphical interface. Could you provide more details on the steps you are following in the interface and the reports you are generating from there? We can then help with the script to follow similar steps.

3. Visitor
Join Date
Jun 2013
Posts
4
would it be possible to have output in one file instead of multiple files? for example:

bcreport.html

also, where exactly output file bcreport.html will be saved?

4. Visitor
Join Date
Jun 2013
Posts
4
also, would it be possible to note only file differences (if any)?

5. Team Scooter
Join Date
Oct 2007
Location
Posts
11,375
It is not possible to have a single HTML report file for multiple text comparisons unless you open a folder compare, select the multiple files you want to compare, then generate the report. If you pass in pairs of files on the command line, we do not support appended reports together.

Code:
log verbose "c:\bclog.txt"
criteria rules-based
expand all
select diff.files
text-report layout:side-by-side options:display-mismatches output-to:"c:\bcreport.html" output-options:html-color
For a plain text report, you could append them together using a batch file:
Code:
bcompare.exe "@c:\script.txt" "c:\file1" "c:\file2"
type tempReport.txt >> mainreport.txt
bcompare.exe "@c:\script.txt" "c:\file3" "c:\file4"
type tempReport.txt >> mainreport.txt
Where script.txt is
Code:
text-report layout:side-by-side options:display-mismatches output-to:"c:\tempReport.txt" "%1" "%2"

6. Team Scooter
Join Date
Oct 2007
Location
Posts
11,375
To show only differences, add the "options:display-mismatches" parameter to the text-report command. Detailed documentation can be found in the Help file -> Scripting Reference, or in the Help file -> Using Beyond Compare -> Automating with Script chapter.

7. Visitor
Join Date
Jun 2013
Posts
4
thank you, this was very useful!