Scripting comparison of 2 files save only when different

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • donahue
    Visitor
    • Jan 2018
    • 5

    Scripting comparison of 2 files save only when different

    Having an issue when I process multiple file compares that the script I am using is creating an html file for all comparisons whether there are differences or not.

    How do you just output to file when there is a difference?

    text-report layout:side-by-side &
    options:ignore-unimportant,display-mismatches &
    output-to:%3 output-options:html-color %1 %2

    Thanks in advance
  • Aaron
    Team Scooter
    • Oct 2007
    • 15996

    #2
    Hello,

    The script itself does not have this built in: the script command will always generate the report. You can put a bat file wrapper around the call to the @script, to only trigger if there is a difference detected between the files. This could use:
    bcomp.com /quickcompare "c:\file1" "c:\file2"
    which would return an %ErrorLevel%, which can be checked if the files are equal or different, then either call to script or not.

    Or, you can generate the report either way (equal or unequal), then parse/scan it to determine if it is empty, then delete it, with an external script solution.
    Aaron P Scooter Software

    Comment

    • donahue
      Visitor
      • Jan 2018
      • 5

      #3
      Originally posted by Aaron
      Hello,

      The script itself does not have this built in: the script command will always generate the report. You can put a bat file wrapper around the call to the @script, to only trigger if there is a difference detected between the files. This could use:
      bcomp.com /quickcompare "c:\file1" "c:\file2"
      which would return an %ErrorLevel%, which can be checked if the files are equal or different, then either call to script or not.

      Or, you can generate the report either way (equal or unequal), then parse/scan it to determine if it is empty, then delete it, with an external script solution.
      Got it..
      Thanks!!

      Comment

      Working...