Announcement

Collapse
No announcement yet.

Quick comparison of subset of files via command line or script

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

  • Quick comparison of subset of files via command line or script

    Hello; wondering if someone can help me achieve the following:

    Desired output: Compare a subset of files in folder 1, to the same subset of files in folder 2 - using the command line or a script - where it reports whether the files match

    Current solution:
    Iterate over an array of file paths calling the command with:
    BComp.com /qc "c:/path/folder1/fileXX.txt" "c:/path/folder2/fileXX.txt"
    Then checking whether the exit code indicates a match

    This works ok - but is a bit slow to run as it launches multiple instances of bcomp.com terminal (one for each file in my subset)

    Is there a way to check all files in one instance of bcomp.com either via a script or another command line call?

    I am after a fast solution to compare a subset of files - where i only care if the overall result is match or not match

    Thanks

  • #2
    Hello,

    If your paths are matching, you could load a folder level comparison and generate either a folder level or file level report from it. I'd recommend starting from the graphical interface's Folder Compare. Is there a common base folder path you can load, and use file name filters (instead of your iteration) to narrow in on the files you want to compare? Then Edit menu -> Expand All and then either Session menu -> Folder Compare Report, or Edit menu -> Select All Files, Actions menu -> File Compare Report.

    If this combination works, then we can work on a script that performs similar steps.
    Aaron P Scooter Software

    Comment


    • #3
      Hi

      The root folder is the same for each file that needs comparing - the extensions could be used to be a filter to limit the scope of comparison.

      A script that would generate a report that did that would be ok - an example script would be much appreciated.

      Thanks

      Comment


      • #4
        Hello,

        Did loading the interface work? It sounds like if the root folders are equal, then you can't load a side by side comparison, as the same file would align to itself. This would have to be configurable for a script to then perform the same steps. If alignment doesn't work, and manual file names must be used, then the iterative calls approach you are using is the best solution.
        Aaron P Scooter Software

        Comment


        • #5
          By root folders are the same - i meant they have the same file tree. not that the files are in the same folder

          There are two folders - both folders have the same files - or should - one is the output - one is the expected output

          Im trying to compare these programmatically and not via the UI - I can compare them via the UI but thats a manual process

          Sometimes though the result almost matches - hence why i would like a script to only compare a subset of files - the important ones.

          Hope this explains it better

          Thanks

          Comment


          • #6
            So a script that compares folder1 to folder2 with a file filter eg only .txt and .csv - which generates a report indicating whether all filtered files match should work. An example script would be very helpful as to how you might achieve this. Thanks

            Comment


            • #7
              Ah, yes. By performing the steps in the interface first, we can better construct the script. Most script commands directly relate to clicks or settings you can do.

              For example, if you've set a file name filter in the interface, you can copy and paste the text in the Filters: toolbar
              *.txt;*.csv
              to script with
              filter "*.txt;*.csv"

              while the base folders themselves can also be pasted as text into the load command (with quotes):
              load "c:\folder1" "c:\folder2"

              So something like:
              filter "*.txt;*.csv"
              load "c:\folder1" "c:\folder2"
              expand all
              folder-report layout:side-by-side options:display-mismatches-no-orphans output-to:"c:\bcreports\bcreport%date%.html" output-options:html-color

              There is also options:display-no-orphans or options:display-mismatches, depending on if you are reporting aligned differences, unaligned orphans, all aligned items (no orphans, but equal or different), etc. Using the interface's Folder Report dialog and the options within it would allow you to iterate different reports, and we can then generate a similar set of options in scripting.
              Aaron P Scooter Software

              Comment

              Working...
              X