Folder Compare and Unimportant Differences

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nbd66m4
    Enthusiast
    • May 2011
    • 25

    Folder Compare and Unimportant Differences

    I am developing a batch process to run compares on several folders each independently. I then scan the report for mismatches and use results from that to flag errors. It all runs fine, except my compares do not ignore unimportant differences.

    When I use BC GUI and load my session, it runs fine tagging files correctly with wavey equal sign. Running in batch unattended it shows those same files as mismatches.

    I created my own myASP, myTxt, myXML file formats moved them to the top and added grammer rules to exclude differences in files like time stamps in comments and server names. These things are not being ignored in batch, but are in GUI.

    I feel I am close.

    I start BC using this:
    "D:\Program Files (x86)\Beyond Compare 3\BComp.com" "@myScript.txt"

    And my script looks like this:
    log verbose "D:\apps\Logs\Common\Shr_Compare_Prod1_to_Prod2_ML Rate_Ratesheet_Script.log"
    load <default>
    load "PROD1 <--> PROD2 FTPRoot\MLRate_Ratesheet"
    filter "*.asp";"*.xml";"*.txt"
    compare rules-based
    criteria rules-based
    folder-report layout:side-by-side &
    options:display-all &
    output-to:"D:\apps\Logs\Common\Shr_Compare_Prod1_to_Prod2 _MLRate_Ratesheet_Report.txt"
  • Aaron
    Team Scooter
    • Oct 2007
    • 15997

    #2
    Hello,

    First, try removing these lines:
    load <default
    compare rules-based
    criteria rules-based

    The act of loading the session "PROD 1 <---> Prod2" will trigger a comparison using that session's Session Settings, similar to loading the session in the graphical interface triggers the background compare.

    If you load the session in the graphical interface, does it automatically perform a rules-based compare? If not, go to the Session Settings, Comparison tab and configure it to run one on load. Next, make sure the Ignore Unimportant toggle is checked in and enabled. Then Save the Session.

    If you load it again in the graphical interface, it should load ignoring unimportant and run your comparison. If this is the case, the script should also respect these settings. You will need to add the folder-report option:ignore-unimportant for the report to also ignore unimportant. This is documented in detail in the Help file -> Scripting Reference, Folder-Report section.

    If you have any questions, please let us know.
    Aaron P Scooter Software

    Comment

    • nbd66m4
      Enthusiast
      • May 2011
      • 25

      #3
      I added the load <default> as it seemed to be a common addition you guys requested to be added. I've tried a lot of combinations. I removed the 3 lines requested above and received the same mismatches output in batch, but not in GUI.

      doug

      Comment

      • nbd66m4
        Enthusiast
        • May 2011
        • 25

        #4
        Regarding the option:ignore-unimportant option on folder-report. We have version 3.2.2 and this is not a supported option on our version for folder-report.

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 15997

          #5
          Sorry about that. First, my mistake: ignore-unimportant is not an option for the Folder-Report, it is used in the file reports. I must have misread the Help file while referencing this.

          Second, load <default> is not bad practice. If you want to use the current graphical default settings (instead of the factory defaults, which is what script will always use otherwise), you:
          load <default>
          load folder1 folder2

          When loading a saved session, the load <default> step is unnecessary since loading the session will simply load everything. The comparison settings, any filters, etc.

          The saved session that you are loading will need to have the toggle Ignore Unimportant enabled, and the files should appear as equal in the graphical interface when first loading the session without needing to click anything. If this is the case, the generated report should also mark the files as equal.

          Two other tips:
          You may need expand all to report on any items in subfolders. Did you want the report to display-all or display-mismatches?

          log verbose "D:\apps\Logs\Common\Shr_Compare_Prod1_to_Prod 2_ML Rate_Ratesheet_Script.log"
          load "PROD1 <--> PROD2 FTPRoot\MLRate_Ratesheet"
          expand all
          folder-report layout:side-by-side &
          options:display-all &
          output-to:"D:\apps\Logs\Common\Shr_Compare_Prod1_to_Prod 2 _MLRate_Ratesheet_Report.txt"
          Aaron P Scooter Software

          Comment

          • nbd66m4
            Enthusiast
            • May 2011
            • 25

            #6
            I tried the script as shown above and it still works fine from GUI (once session loaded it goes right into compare and ignore unimportant differences), but is not working as expected in batch (it still marks files as mismatch).

            I do not want to process subfolders, just files in folder.

            Is there another report format that will work? I don't care about reviewing the repoirt visually, I just search it using DOS FIND looking for count of "<>" strings. I prefer to not do a file by file comparison, but could - it would force me to quit/fail on 1st error as I would reuse report file name (we are comparing 5-8 folders which will end up with 4-5000 report files - not something we want to manage daily. So letting each set of file compares output to same report file would probably be our direction.

            Comment

            • nbd66m4
              Enthusiast
              • May 2011
              • 25

              #7
              I think I'm good.

              I tested a few other options and this script gives me a similar enough report output nothing else in my batch process required changing except the script and passing in the folder names (which was optional - could have hard coded in script.

              log verbose "D:\apps\Logs\Common\Shr_Compare_Prod1_to_Prod2_Af finity_Ratesheet_Script.log"
              filter "*.asp;*.xml;*.txt"
              criteria rules-based
              load <default>
              load %1 %2
              expand all
              select diff.files newer.files older.files
              text-report layout:side-by-side options:ignore-unimportant,display-mismatches &
              output-to:"D:\apps\Logs\Common\Shr_Compare_Prod1_to_Prod2 _Affinity_Ratesheet_Report.txt"

              Here is the DOS batch routine I'm using:
              oCompare
              echo Unused Parm1=%1
              %BCPGM% %BCOPTS% "@D:\Apps\Runtime\Common\Control\%BCSCRIPT%_Script .txt" %2 %3
              set ERRLVL=%errorlevel%
              echo ERRLVL=%ERRLVL%
              if %ERRLVL% GEQ 13 goto :Error

              if NOT Exist D:\Apps\logs\Common\%BCSCRIPT%_Report.txt goto :FILENFND

              :_ ==> Look for Error strings in file
              find /c "<>" D:\Apps\logs\Common\%BCSCRIPT%_Report.txt >D:\Apps\logs\Common\%BCSCRIPT%_FindCnt.txt
              set ERRLVL=%errorlevel%
              echo ERRLVL=%ERRLVL%

              FOR /F "tokens=1,2,3,4* delims=/:" %%i in (D:\Apps\logs\Common\%BCSCRIPT%_FindCnt.txt) do set CNT=%%k
              echo CNT=%CNT%
              if "%CNT%" NEQ " 0" echo %CNT% mismatches found for %BCSCRIPT% - exiting
              if "%CNT%" NEQ " 0" Exit /b 1

              goto :EOF


              Here is the part of code calling oCompare
              set RC=Compare_Affinity
              set FOLDER=Affinity_Ratesheet
              set BCSCRIPT=%BCSCRPT%%FOLDER%
              call oCompare %SESSION% %PROD1BASE%\%FOLDER% %PROD2BASE%\%FOLDER%
              if errorlevel 1 goto :Error
              Last edited by nbd66m4; 22-Aug-2012, 11:11 AM. Reason: Try to remove icons...

              Comment

              • Aaron
                Team Scooter
                • Oct 2007
                • 15997

                #8
                Hello,

                I'm not sure why the loaded graphical session would not work, but setting up the comparison manually would. The only thing I can think of is if you have multiple users accounts; BC3 stores settings on a per user basis. If the script were somehow running as a different user, which had the same session name stored but different session settings, that could explain a different in behavior when loading the Script User's session vs. the Graphical User's session.

                Either way, I'm glad you were able to get this working in your script. If you run into any other problems, please let us know. One preemptive tip: use a Portable Install that your automation can reference. This way, no matter which user is running that Portable Install, it would use the same settings regardless.
                Aaron P Scooter Software

                Comment

                • nbd66m4
                  Enthusiast
                  • May 2011
                  • 25

                  #9
                  I'm logged on to server using the same userid as the "owner" of the job submitted via our scheduler and my understanding is the job owner uses those credentials when running jobs - but you make a very good point.

                  I'm a little curious as to differences in what is written to the text report files. I'm asking for mismatches only and of the 8 iterations of my compare process (8 different folders) 6 of the reports list the file names of the files in that folder, and since everything matches, I only see header info at top showing what folders are being compared and what options are in effect, then the list of file names with 2 blank lines seperating them. On 2 of the files, nothing is in the file. No file names, nothing, not even the header details.

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 15997

                    #10
                    Hello,

                    Depending on what your script looks like now, it could be your select statement and your criteria. I would guess that in some cases, it is selecting all of your files but the report then generates only on mismatches, so that there is no content shown. In other cases, the select statement does not grab anything (due to there being no Newer files if the criteria is only rules-based), at which point there was no selection for the report command to act on.

                    Or perhaps they are all Orphan? Diff, Newer, and Older would not select an Orphan file.

                    If you load the folder pairs in the graphical interface, each in their own tab, how do each of the file pairs compare? You can use the View menu -> Legend to help distinguish what each coloring means.
                    Aaron P Scooter Software

                    Comment

                    • CodyFyler
                      Journeyman
                      • Jan 2013
                      • 14

                      #11
                      Aaron, why is the folder report the only one that doesn't have the ignore unimportant option?

                      I don't want to have to load the gui first (so I can share a script with others) and set defaults or load a session.

                      A folder comparison that can't ignore the differences between for instance tabs and spaces is not very useful.

                      Comment

                      • Aaron
                        Team Scooter
                        • Oct 2007
                        • 15997

                        #12
                        Hello Cody,

                        Adding the Ignore Unimportant option is on our wishlist. In the meantime, you can apply the setting by loading a saved Folder Compare in script with the option enabled. The session could be called "IgnoreUnimportantEnabled". Then immediately load the pair of folders and the loaded session settings will be applied during that load:

                        load "IgnoreUnimportantEnabled"
                        load "C:\folder1" "c:\folder2"
                        expand all
                        folder-report ...

                        By default, the script should ignore differences between tabs and spaces, so I would expect something else is going on here. Perhaps the file sizes are different, and the script is running a timestamp/size comparison instead of a rules-based comparison?

                        criteria rules-based
                        load "C:\folder1" "c:\folder2"
                        expand all
                        folder-report ...
                        Aaron P Scooter Software

                        Comment

                        Working...