Results 1 to 7 of 7
  1. #1
    Join Date
    May 2017
    Posts
    4

    Default 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. #2
    Join Date
    Oct 2007
    Location
    ITALY
    Posts
    209

    Default

    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

  3. #3
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    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 at 10:21 AM.
    Aaron P Scooter Software

  4. #4
    Join Date
    May 2017
    Posts
    4

    Default

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

  5. #5
    Join Date
    May 2017
    Posts
    4

    Default

    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 at 07:27 AM. Reason: spelling

  6. #6
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    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

  7. #7
    Join Date
    May 2017
    Posts
    4

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •