Treant synchronization

These are the API components of datreant.core for synchronizing Treants locally and remotely.


The synchronization functionality is provided by the rsync wrapper function. The function is used by the datreant.core.Tree.sync() method.

datreant.core.rsync.rsync(source, dest, compress=True, backup=False, dry=False, checksum=True, include=None, exclude=None, overwrite=False, rsync_path='/usr/bin/rsync')

Wrapper function for rsync. There are some minor differences with the standard rsync behaviour:

  • The include option will exclude every other path.
  • The exclude statements will take place after the include statements
  • source (str) – Source directory for the sync
  • dest (str) – Dest directory for the sync
  • compress (bool) – If True, use gzip compression to reduce the data transfered over the network
  • backup (bool) – If True, pre-existing files are renamed with a “~” extension before they are replaced
  • dry (bool) – If True, do a dry-run. Useful for debugging purposes
  • checksum (bool) – Perform a checksum to determine if file content has changed.
  • include (str or list) – Paths (wildcards are allowed) to be included. If this option is used, every other path is excluded
  • exclude (str or list) – Paths to be excluded from the copy
  • overwrite (bool) – If False, files in dest that are newer than files in source will not be overwritten
  • rsync_path (str) – Path where to find the rsync executable