No announcement yet.

Scripting to compare Pre and Post upgrade files

  • Filter
  • Time
  • Show
Clear All
new posts

  • Scripting to compare Pre and Post upgrade files

    We are in the middle of an upgrade and would like to compare pre and post upgrade files to make sure the upgrade was successful and files are the same. There are hundreds of files that need to be compared and we need an easy way to get this done.
    Question: How can i write a python script to integrate with beyond compare where the comparison of both files can be automated by running the python script and creating a report of files that are different and the same between both data?

  • #2

    Is this a task that needs to be repeated (once a week automation), or are you running it one time to verify this specific upgrade? A one time scan wouldn't necessarily need automation, as the Folder Compare can load two base folders, and compare side by side (timestamp/size by default, but content scans can also be enabled in the Session menu -> Session Settings, Comparison tab: Binary or Rules-based). A report from this view can also be generated using the Session menu -> Folder Compare Report, output type HTML, layout: side-by-side, with Include File Links enabled. Or alternatively, you can set the Display Filter to only show differences, then use the Edit menu -> Expand All, Edit menu -> Select All Files, and the Actions menu -> File Compare Report, which generates a single report file containing the file content of the selected different files.

    These strategies can also be written up as a BCScript, depending on which report type you need. I would suggest going through the graphical interface first to determine which report works best, and then we can help with the exact scripting to generate the same thing in an automated environment if that's needed. Scripting documentation is also found in the Help file -> Using Beyond Compare -> Scripting chapter (and Scripting Reference chapter).
    Aaron P Scooter Software


    • #3
      This will be done more than one and for multiple environments, which is why we feel automating will be better. The files we are comparing are have specifications so we need to compare some individually. We just need an easier way to do this since there are almost 100 different specs that needs to be validated,


      • #4
        Sure thing. The scripting mode can generate the same reports, such as:
        load"%1" "%2"
        expand all
        select all.newer.files all.older.files all.different.files all.orphan.files
        text-report layout:side-by-side options:display-mismatches output-to:"%3" output-options:html-color

        where the command line would be:
        bcompare.exe "@c:\scripts\bcscript.txt" "c:\folder1" "c:\folder2" "c:\scripts\report1.html"

        I would still suggest generating the report once in the graphical interface first, so you can quickly load your content and determine which report and which options to use; then we can generate the script that can generate the same report. The above script also includes all text in orphan files, which can be very large. Did you want to include them in the report, or only the aligned different files and their differences?
        Aaron P Scooter Software