No announcement yet.

script to compare files and fins a different file

  • Filter
  • Time
  • Show
Clear All
new posts

  • script to compare files and fins a different file

    I am looking to write a script that will look at files and find one that is different

    something like this:

    criteria rules-based

    compare file1.s19 file2.s19 /silent
    compare file1.s19 file3.s19 /silent
    compare file1.s19 file4.s19 /silent

    and so on...

    I don't want the compare window to show, so that is what I think the silent will do.
    I just want a flag or some sort to show the results as either the files are the same or different:

    file1.s19 - file2.s19 SAME
    file1.s19 - file3.s19 SAME
    file1.s19 - file4.s19 DIFFERENT

    Then I will look at the graphical version to find the actual differences.
    I am generating a lot of files that I want to compare, and don't want to sit there and open each file in BC to make every compare. Most should be the same, so I'm really looking for the different file.


  • #2

    You want to use bcqc.exe included in the Beyond Compare 2 install directory. Run bcqc.exe /? for Help documentation. After comparing two files, it will set the %errorlevel% variable to a particular value based on the comparison. Try it out on the command line and let us know if you have any questions.
    Aaron P Scooter Software


    • #3
      Aaron, Thanks for the tip, I found bcqc, and set up my path to access it.

      I am not getting any results to display.

      I am typing in

      bcqc /b diab42b.bat diab42bR.bat

      and it takes a few seconds, and then I just get the prompt.
      The help shows it will output to DOS ErrorLevel a number indicating the results.
      How do I see what that result is?


      • #4
        After running BCQC, issue the command "echo %errorlevel%" to print the error level to the screen.
        Chris K Scooter Software


        • #5
          Got it working. Great time saver as I was dumping 4000 images from flash in a module overnight, and wanted to just find any that were different from the master dump.
          The compare ran quick in about 15 - 20 minutes for all 4000 files, rather than using the GUI it takes 2-3 minutes per file and I have to do the compares by hand (since all the files have different names).

          Thanks again.


          • #6
            You're welcome.

            File names are important for our alignment in the graphical interface. A BC3 Pro feature called Alignment Overrides would allow you to align differently named files using DOS masks or Regular expressions (such as *.jpg to *.png). The mask is used for the identical section, and the different text must be stated explicitly. You can test this with the BC3 trial if you are interested. The BC3 trial does not require you to uninstall BC2; you can install both and they install to different directories by default, and store separate settings.

            BC3 also has a bcqc.exe function, but it is a command line argument instead of a separate .exe.
            Last edited by Aaron; 01-Mar-2010, 05:43 PM. Reason: grammar
            Aaron P Scooter Software


            • #7
              I often compare different named files using the GUI. I right click and select compare to.
              As for aligning different names, I was basically comparing the master image with the multiple extracted images. So it was a one to many file compare, so aligning different file names would not have worked, the script worked excellently.

              This is a great tool.