No announcement yet.

explicit help with folder comparison script and calling it from command line

  • Filter
  • Time
  • Show
Clear All
new posts

  • explicit help with folder comparison script and calling it from command line


    I've read the command-line reference, the scripting reference, the sample scripts and some other things. I don't use BC very much and trying to put all that stuff together without many examples that explicitly spell things out is too much. I would really appreciate some explicit help comparing two folders with a BC script. I eventually want to call the BC script from a Perl script, but if I can get the command-line command right to just call the BC script first that will be a step in the right direction.

    I am automating the auditing of our labeled builds. I need to compare two folders to see if their contents match. The one on the left will be the baseline to compare the one on the right to. If they don't match I'd like to know how the right differs from the baseline on the left. Ideally, I'd like to have some code returned indicating if the files are an exact content match or not, but I believe I've read that BC doesn't have that capability. Because it's automated, I'd like the GUI not to display and to have any differences written to a log. I've cobbled together a script that I think will work:

    log verbose "cacheCompare.txt"
    criteria crc
    load "$1" "$2"
    expand all
    select left.diff.files left.orphan.files
    copyto left path:relative "C:\currentWork\AuditingBuild\CachedInstallerDifferences.txt"
    but I don't know if it's actually what I'm looking for.

    I have used both these commands:

    C:\Program Files (x86)\Beyond Compare 3>BCompare.exe @"C:\currentWork\AuditingBu
    ild\cacheCompareScript.txt" "C:\currentWork\AuditingBuild" "C:\currentWork\Perl
    C:\Program Files (x86)\Beyond Compare 3>BCompare.exe @C:\currentWork\AuditingBu
    ild\cacheCompareScript.txt "C:\currentWork\AuditingBuild" "C:\currentWork\Perl
    from the command line and both produce this same output:

    12/31/2012 5:25:58 PM  >> log verbose "cacheCompare.txt"
    12/31/2012 5:25:58 PM  >> criteria crc
    12/31/2012 5:25:58 PM  >> load "$1" "$2"
    12/31/2012 5:25:58 PM  Load comparison:  <-> 
    12/31/2012 5:25:58 PM  Fatal Scripting Error: Unable to load base folder
    12/31/2012 5:26:00 PM  Script completed in 2.2 seconds
    Any help with explicitly spelled out examples would be greatly appreciated.


  • #2
    All of that looks pretty good, except you'll want to use "%1" instead of "$1".

    $1 is for RegEx references, such as when defining Text Replacements or Grammar.
    %1 is for the command line parameters in scripting

    You might also want to put quotes around "@c:\currentWork\...\script.txt" just in case that path ever has spaces added to it.

    Does that get everything working as you expect?

    I also suggest always testing script with test or already backed up files, so while learning script you do not accidentally alter any live data, just as a precautionary measure.
    Aaron P Scooter Software