Announcement

Collapse
No announcement yet.

Can I use the same script to compare different folders?

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

  • Can I use the same script to compare different folders?

    I need to sync different pairs of folders.
    Is there a way to use the same script, or do I have to make one for each folder pair?

    This is what I have:
    ---------------------------------------------------------
    load "C:\Path 1"&
    "C:\Path 2"

    collapse all

    filter "*.xls*";"*.txt"
    sync visible update:left->right
    sync visible update:right->left

    ---------------------------------------------------------
    Now I want to do it with "C:\Path 3" and "C:\Path 4", etc.

    Is there another way to do this without having to create a Beyond Compare Script file for each pair?

    The Beyond Compare Scripting ability is very useful!
    Thanks so much for your help!

    Frances

  • #2
    Hello, I believe that inside the script You can use %1 and %2 and pass the different folder paths.
    So, one single script, but called several times with different parameters.


    Regards

    Rodolfo Giovanninetti

    Comment


    • #3
      Hello,

      Yes, you can use command line parameters to insert folder text (or any text) into the script.

      The command line would look like:
      bcompare.exe "@c:\bcscript.txt" "c:\path1" "c:\path2"

      The following text can be used with %1 and %2 in the script:
      load "%1"&
      "%2"
      collapse all
      filter "*.xls*";"*.txt"
      sync visible update:left->right
      sync visible update:right->left


      You can find more example information in the Help file -> Using Beyond Compare -> Scripting chapter.
      Last edited by Aaron; 30-May-2017, 12:21 PM.
      Aaron P Scooter Software

      Comment


      • #4
        Thanks, Aaron and RodolfoGiovanninetti!
        This scripting ability is saving me gobs of time!

        Comment


        • #5
          I ran into this problem when I modified the files to do the above.

          My bat file:
          - - - - -
          "C:\Utils\Beyond Compare 4\BCompare.exe" @"BC_script.txt" "C:\path_1" "C:\path_2"
          - - - - -

          My BC_script.txt:
          - - - - -
          load "%1" "%2"
          etc.
          - - - - -

          I get these errors:
          "C:\path1" is not recognized as an internal or external command, operable program, or batch file.
          "C:\path2" is not recognized as an internal or external command, operable program, or batch file.

          Am I missing something?

          Appreciate your help very much, Aaron & Rodolfo!
          Many thanks!
          Last edited by Beach-Biker; 02-Jun-2017, 09:27 AM. Reason: spelling

          Comment


          • #6
            Hello,

            Where are you seeing these errors? On the command line or in the scripting pop-up window that appears if BC4 is successfully launched in script mode?

            They look a bit like command line errors (so BC4 isn't even starting up), at which point I think " characters might be the issue. Try running from the Windows Command Line manually to test first:
            "C:\Utils\Beyond Compare 4\BCompare.exe" "@C:\BC_script.txt" "C:\path_1" "C:\path_2"

            A relative path would work for the script file, but you'd need to manage where you are calling the script from. Otherwise, include an absolute path to the script file to allow it to always find it and work.

            As for the script, test with test folders first since script will not preview and does not offer an Undo:
            filter "*.xls*;*.txt"
            load "%1" "%2"
            collapse all
            sync visible update:left->right
            sync visible update:right->left

            I assumed you had used script before since you were purposefully collapsing and using visible. If you are not familiar with scripting, are you certain you would want to perform these specific, limiting steps? Collapsing and visible will not sync any items within subfolders. If you only want to sync the file types but do want subfolder items, then the filter command is all you need.
            Aaron P Scooter Software

            Comment


            • #7
              Thanks Aaron! I'll try this out.

              Yes. I'm purposefully just doing to top level folder, because the subfolders aren't important in this case.

              Comment

              Working...
              X