No announcement yet.

Script a Folder Compare with different rules for each set of files. Is it possible?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Script a Folder Compare with different rules for each set of files. Is it possible?


    Using BC4 4.3.4 build 24657 Pro Edition.

    So I am able to script multiple file compares with different rules by editing BCsessions.xml on the fly to update the defaults before I call the command for each specific file pair.

    My question is, is it possible to run a folder-report (left vs right) where I can define the rules (keys, unimportant columns etc.) to be used by each subset of file pairs within the folder directory?

    Run Folder-report
    set rules for file 1 compare
    Compare /left_folder/file1.txt to /right_folder/file1.txt
    set rules for file 2 compare
    Compare /left_folder/file2.txt to /right_folder/file2.txt
    set rules for file 3 compare
    Compare /left_folder/file3.txt to /right_folder/file3.txt
    Produce output Report

    Let me know if you need clarification..


  • #2

    Let's start in the graphical interface. If you create a new Folder Compare session, then double click on file1 to open the child file view, go to the child session's Session Settings, update the settings, and at the bottom update the dropdown from "Use only for this view" to "Use for these files in parent session".

    Close the child session tab, go back to the parent Folder Compare and Save Session. Repeat for another file pair in the parent and re-save the parent again.

    Scripting can then load this session name, and if you generate a folder compare with linked file reports, or select the files and generate a data-report, it will use the saved child settings from the parent session.

    You could also edit the BCSessions.xml to alter this saved session to meet your new file needs, then load "folder session name" in script.

    Before going too deep into this solution, I'd recommend setting up a basic script scenario with test files, to help generate a simple report. You can then slowly integrate these more complicated solutions to build up something with edited child settings. "folder session" should also have the comparison criteria and filtering saved as part of it, to help limit which files need selecting and report generation.

    load "folder session"
    expand all
    select all.newer.files all.older.files all.different.files all.orphan.files
    data-report layout:side-by-side output-to:"c:\temp\bcreport.html" output-options:html-color
    Aaron P Scooter Software


    • #3
      Thank you Aaron, this was very helpful.

      I am now able to script a folder-report with saved child rules settings from the parent session.

      One more question, the "content compare" (middle) icon which is displayed in the UI is not displayed in my html output report. Is there a way to have this also displayed on the html output?



      • #4

        The column should be populated if a content scan has been run. Is the script set to run a content scan (by loading the session name with a background scan set in Session Settings, or by running criteria manually after the session is loaded)? If you can post or email in your script file, we can double check it.

        If emailing, you can also include your from the Help menu -> Support; Export, a copy of the report, and a link back to this forum thread for our reference.
        Aaron P Scooter Software


        • #5
          Thanks again Aaron, once I updated the session settings and clicked the Compare contents -> rules based comparison. It has resolved the issue.