No announcement yet.

Comparing text files using a loop

  • Filter
  • Time
  • Show
Clear All
new posts

  • Comparing text files using a loop

    I have a script that compares text files similar to the one in the Help:
    text-report layout:side-by-side &
    options:ignore-unimportant,display-context &
    output-to:%3 output-options:html-color %1 %2

    If I want to perform multiple file1/file1a, file2/file2a, ...fileN/fileNa
    would my batch file be something similar to the following:

    BCompare.exe @"script.txt" file1 file1a report1.txt
    BCompare.exe @"script.txt" file2 file2a report2.txt
    BCompare.exe @"script.txt" fileN fileNa report1.txt

    Or is there a simple way to perform this using a loop? Also, is there a way to have 1 report where each subsequent report gets appended?

  • #2

    The loop would need to be controlled by the overall script file that is calling to BC3. This would depend on the language and setup of how you are calling:
    BCompare.exe @"script.txt" file1 file1a report1.txt

    And how it would determine the names of file1, etc. I found an example article covering Bat files, here:

    BC3 itself does not allow appending of reports, but if it is a plain text report, you can append it to a main report. As an example bat file:
    BCompare.exe @"script.txt" file1 file1a reportTemp.txt
    type reportTemp.txt >> MainReport.txt
    BCompare.exe @"script.txt" file2 file2a reportTemp.txt
    type reportTemp.txt >> MainReport.txt
    Aaron P Scooter Software