Announcement

Collapse
No announcement yet.

Sync folder but exclude subfolders

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

  • Sync folder but exclude subfolders

    Hallo,
    i want to sync a directory structur like this:

    Source:
    D:\Projects\application
    D:\Projects\database
    D:\Projects\webapps

    Destination:
    R:\Projects\application
    R:\Projects\database
    R:\Projects\java
    R:\Projects\webapps

    in the d destination directory (rt) the "java" folder and its subfolder should dont touch

    Here is my script:

    log build/log/bc2_Sync.script.log
    option confirm:yes-to-all
    criteria timestamp size CRC binary
    load D:\Projects R:\Projects
    filter "-\java"
    filter attrib:none
    expand all
    select all.diff.files
    sync create-empty mirror:lt->rt

    after executing the script the R:\Proejcts\java folder is empty.
    Can any one tell me whats wrong?

    Georg

  • #2
    Hello,

    First, I would strongly recommend using the program interactively to determine what you need. Each script step is a step you can take interactively and can be tested as such. The GUI also provides a preview of what will happen before it is performed.

    You have a few issues with your script.

    criteria does not need size, crc, and binary. You can pick one and just use that. You do not need timestamp unless you want to compare that. You can just use criteria binary, and different files will be synchronized.
    *You should test using the GUI if timestamp/size (default) is enough for the comparison, or if you need binary. A binary scan will take much longer to run.

    Your filter line should be -java\. It is the same text that appears in the upper right corner textbox of the interface. You can type in the textbox, or use the FIlters dialog to add filters, then copy and paste the text from the textbox back into your script once you are confident it is filtering out the proper items.
    Also, calling filter twice in a row negates the first call. It sets the filter, then resets it as the 2nd line. Also, unless your default session using Attribute filters, you do not need to filter on attrib:none
    You also do not need to select files before performing a sync mirror. Sync Mirror set destination to be the same as the source; deleting files that do not exist in Source, and copying any differences it finds.

    Here is a sample script. You may not need the criteria line, if the default timestamp/size is good enough of a comparison.

    log build/log/bc2_Sync.script.log
    option confirm:yes-to-all
    criteria binary
    load D:\Projects R:\Projects
    filter "-java\"
    #Comment lines. if you need it:
    #filter "-java\" attrib:none
    expand all
    sync create-empty mirror:lt->rt
    Aaron P Scooter Software

    Comment


    • #3
      Thanks

      now it works

      Georg

      Comment

      Working...
      X