Announcement

Collapse
No announcement yet.

Defining compare rules inside script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ZoŽ
    replied
    Re: Defining compare rules inside script

    Is this option available only in the latest version of bc2?
    It was first added in 2.1 (Jan '04). We did change it in 2.4 to make it's usage more consistent.

    Is it possible for us to get a count of differing files (when folder comparison is done) in the comparison report output? My intention is this: I want to run bc2 on a set of folders in batch mode and stop comparison/send mail whenever I find any difference in folder comparison. So I was thinking of putting comparison report output in some file and then search for the difference count there. Can this be done?
    We don't support a "Statistics" report style in the directory comparison like we do in the file viewer, but we really should. I'll add that to our wishlist for a future release.

    You can do what you want, but it might not be quite as easy as you want. You'll need to generate an XML report and parse the output. If you set the display filters to only include mismatches the report collapses down to just a few lines of text. I'd recommend this:

    folder-report layout:xml options:display-mismatches output-to:C:\outputfile.txt

    Then just scan C:\outputfile.txt for <filecomp. Since the report doesn't include matching files, if the output includes any file comparisons you know there's a mismatch.

    If you need specific counts you'll need to parse the XML and count the <filecomp> nodes manually. Each filecomp node has a status attribute that says what the comparison results are. It will be one of "match", "mismatch", "ltonly", "rtonly", "ltnewer", and "rtnewer".

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Re: Defining compare rules inside script

    Hello Craig,

    Thanks very much for your hint ... The /rules="" works for me. Is this option available only in the latest version of bc2 ??? I was earlier using version 2.0 and could not find this option there.

    I have one more doubt. Kindly clarify.

    Is it possible for us to get a count of differing files (when folder comparison is done) in the comparison report output?

    My intention is this: I want to run bc2 on a set of folders in batch mode and stop comparison/send mail whenever I find any difference in folder comparison. So I was thinking of putting comparison report output in some file and then search for the difference count there. Can this be done?

    Thank you,
    Venkatesh

    Leave a comment:


  • ZoŽ
    replied
    Re: Defining compare rules inside script

    Hi Venkatesh,

    It isn't possible to define rules from within a script. You need to set them up interactively.

    If you use Beyond Compare both for scripting and interactively and the rules you need for the script don't apply during interactive comparisons you should just make a seperate copy of the BC2 executable (and sfFTPLib.dll if you use FTP) and set them up using the "Single-directory mode" that's documented in the Help under "Managing Stored Settings". Use that copy for scripting, and once you have it set up you can add or customize your rules without affecting your interactive comparisons.

    Alternatively, if it's a single set of rules that should be used for all file comparisons you can use the /rules= command line option.

    Leave a comment:


  • Guest's Avatar
    Guest started a topic Defining compare rules inside script

    Defining compare rules inside script

    Hello,

    Is it possible to define compare rules inside a bc script??? I have a sample script given below:

    but i want to add some rules for comparison here. Can anybody help me in defining the rules?

    Thank you,
    Venkatesh

    # Turn logging on
    log normal "bc2Comparision.log"

    # Load the default session and exclude all but certain file types
    load <default>
    filter "*.html;*.htm;*.log"

    # Load the folders to be compared
    load "%1" "%2"

    # Must open folders to see diffs
    expand all
    select all

    # Only evaluate test results
    # Consider only text-based comparison
    # Criteria rules-based
    compare rules-based

    # Generate report of diffs (summary list, all mismatches)
    report format:51d output:"%3"
Working...
X