Syncing Multiple Folders

The tdsync tool can be used to synchronize multiple folders in a single run, and to watch multiple folders for changes simultaneously.

By default, the tdsync tool will treat the current folder as the synchronization root. Alternatively, users can specify one or more folders as the trailing command-line parameters to the tool, and the tool will sync each of those independently, as its own synchronization root. If any folder within a synchronization root structure contains a .tdsyncrc file, then that folder will also be treated as a synchronization root, and will not be included in its parent folders' sync.

Take the following command as an example.

tdsync C:\folder1 C:\folder2 C:\folder3

This command will scan all three folders for .tdsyncrc files, and sync each folder containing them independently. If --watch is also specified, it will watch all of those folders for changes, and sync them using their individual configurations as needed.

A folder is considered a synchronization root if its configuration is complete, meaning that all of the required parameters are available either in their .tdsyncrc hierarchies or available from the command-line. If a complete configuration is available from the command-line, then each specified root folder (or, if none are specified, the current folder) will be actively synced as well as any sub-folders containing .tdsyncrc files.

Sample Configuration Hierarchy

Suppose we had the following folder hierarchy and tdsync configuration files.

root
  - .tdsyncrc (contains url, username, and password)
  + folder1
    - .tdsyncrc (projectKey=1)
    + folder1a
      - .tdsyncrc (projectKey=2)
  + folder2
    - .tdsyncrc (projectKey=3)

This folder structure contains 4 .tdsyncrc files, but since the one in root is incomplete (no project key), it contains only three sync roots. In addition, even though folder1a is inside folder1, it is not included in folder1's sync because it is a separate sync root.

We could run tdsync in any of these folders.

  • If we run on root, all three sync roots will be synced.
  • If we run on folder1, both folder1 and folder2 will be synced. Note that we do not need to execute tdsync on root for its configuration to be used by its subdirectories.
  • If we run on folder1a or folder2, only that folder will sync.