docs/src/sync-configuration.md

Sun, 10 Jun 2018 13:24:30 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 10 Jun 2018 13:24:30 +0200
changeset 413
241db665477a
parent 409
90a6d6952d83
child 428
b50ade8e7197
permissions
-rw-r--r--

fixes build on non-windows

---
title: 'Configuration'
---

The file `$HOME/.dav/sync.xml` is used for configuring sync-directories.

The *sync.xml* file is an XML file with `<configuration>` as root element. This element can only have `<directory>` elements as children.

## directory

This element configures a sync-directory. A sync-directory must have a unique name, a (local) path, repository and a database.

Required elements: `<name>`, `<repository>`, `<path>`, `<database>` \
Optional elements: `<collection>`, `<trash>`, `<max-retry>`, `<backup-on-pull>`, `<lock-pull>`, `<lock-push>`, `<lock-timeout>`, `<filter>`

### name

Unique sync-directory identifer. This identifer is used in combination with all *dav-sync* commands.

Type: string \
Example: `<name>mysyncdir</name>`

### repository

Name of the WebDAV-repository. A repository with the same name must be configured in [config.xml][1].

Type: string \
Example: `<name>myrepo</name>`

### path

The path of the local directory that should be synchronized. The path must be an absolute path or start with an environment variable. A path with an environment variable must start with an `$` followed by the variable name optionally followed by a path. For example:

	`<path>$HOME/Documents</path>`

The part between `$` and `/` is the environment variable name.

Type: string \
Example: `<path>/absolute/path</path>`

### database

Path to the database file used for this sync-directory. The path must be relative to the *$HOME/.dav/* directory.

Type: string \
Example: `<database>myrepo-db.xml</database>`

### collection

Path of the collection relative to the repository root collection. For example if the repository url is *http://example.com/webdav/* and the collection value is */myfiles/*, the directory is synchronized with *http://example.com/webdav/myfiles/*

Type: string \
Default: / \
Example: `<collection>/myfiles</collection>`

### trash

Path to the trash directory for this sync-directory. Files that should be deleted will be moved to this directory. The value must be an absolute path or relative to the sync-directory path.

Type: string \
Example: `<trash>.trash</trash>`

### max-retry

This integer value controls how many attempts of downloading/uploading a file in case of an error are made.

Type: integer \
Default: 0 \
Example: `<max-retry>3</max-retry>`

### backup-on-pull

If this element has the value of true, the *pull* command will move old local files to the trash directory before downloading the new version from the server. 

Type: boolean \
Default: false \
Example: `<backup-on-pull>true</backup-on-pull>`

### lock-pull

Enables locking for the *pull* command.

Type: boolean \
Default: false \
Example: `<lock-pull>true</lock-pull>`

### lock-push

Enables locking for the *push* command.

Type: boolean \
Default: false \
Example: `<lock-push>true</lock-push>`

### lock-timeout

Specifies the lock timeout in seconds. If the lock-timeout is 0, the client doesn't request a specific timeout and the server's default value is used. If the lock-timeout is -1, a infinite timeout is requested.

Type: integer \
Default: 0 \
Example: `<lock-timeout>50</lock-timeout>`

### filter

With the filter element, include and exclude filters can be specified, to control which files are synchronized. The *pull*, *push* and *archive* command apply these filters to file paths. At first it is checked if a file is matching any include filter. If so only files matching not an exclude filter are further processed.

It is also possible to filter resources by tags. Tags can dynamically be applied to individual files. The tag filter elements contains a tag filter expression. Only files that match the filter expression are synchronized.

Note: The file path is relative to the directory path (and WebDAV collection) but always starts with an path separator.

Optional elements: `<include>`, `<exclude>`, `<tags>`

### include

Controls which files will be included by *pull* and *push*. If an include filter is specified, only files matching this filter are included.

Type: regex string \
Default: .* \
Example: 

	<filter>
		<include>\.pdf$</include>
	</filter>

### exclude

Controls which files will be excluded by *pull* and *push*.

Type: regex string \
Example:

	<filter>
		<exclude>^/secretdir</exclude>
		<exclude>\.DS_Store$</exclude>
	</filter>

### tags

TODO

Type: tag filter expression \
Example:

	<filter>
		<!-- sync only resources that have one of this tags -->
		<tags>| (tag1, tag2, tag3)
	</filter>

mercurial