# HG changeset patch # User Olaf Wintermann # Date 1502023280 -7200 # Node ID 0e36bb75a732298c795b870ebc263cc305a5afc4 # Parent 3070d72f54af410da6fbe42c546f4ce16308339f adds dav-sync introduction and sync.xml documentation diff -r 3070d72f54af -r 0e36bb75a732 docs/html/add-directory.html --- a/docs/html/add-directory.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/add-directory.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav-sync add-directory @@ -64,7 +64,9 @@
-

dav-sync add-directory

+

This command runs an interactive assistant that creates a sync-directory configuration and adds it to the sync.xml file. Before running this command, a repository must be created. See dav add-repository.

Command alias: add-dir

The assistant firstly asks for a unique sync-directory name. This may not match the physical directory name. If you are not sure, which names are already in use, you can get a list of currently present sync-directories with dav-sync list-directories. Then you specifiy the local path, select the dav repository and specify the collection within that repository. You may use environment variables like $HOME within the path name. A call of add-directory may look like this.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/add-repository.html --- a/docs/html/add-repository.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/add-repository.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav add-repository @@ -64,7 +64,9 @@
-

dav add-repository

+

This command runs an interactive assistant that creates a repository configuration and adds it to the config.xml file.

Command alias: add-repo

The assistant firstly asks for a unique repository name. If you are not sure, which names are already in use, you can get a list of currently present repositories with dav list-repositories. Then you specifiy the base URL and optional authentication information. Please keep in mind, that the password is stored base64 encoded in your configuration. If you do not want this to happen, leave the password blank. dav will ask you for the password when accessing the repository. Beware that you don't use password prompt in background jobs, though. A call of add-repository may look like this.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/check-config.html --- a/docs/html/check-config.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/check-config.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav check-config @@ -64,7 +64,9 @@
-

dav check-config

+

Validates the config.xml file. If the config is ok, it prints Configuration OK. to stdout and returns 0, otherwise it prints an error message to stderr and returns 1.

Command alias: check

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/check-repositories.html --- a/docs/html/check-repositories.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/check-repositories.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav-sync check-repositories @@ -64,7 +64,9 @@
-

dav-sync check-repositories

+

Checks if every repository used by sync-directories is configured and available. This command outputs the status for each repository. It returns zero when all repositories are all available and non-zero otherwise.

Command alias: check-repos

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/commands.html --- a/docs/html/commands.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/commands.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + Commands @@ -64,7 +64,9 @@
-

Commands

+

Overview

List resources:

dav list <url>
diff -r 3070d72f54af -r 0e36bb75a732 docs/html/configuration.html --- a/docs/html/configuration.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/configuration.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + Configuration @@ -64,7 +64,9 @@
-

Configuration

+

The main configuration file for dav is $HOME/.dav/config.xml and is used for configuring repositories, proxies and encryption keys. This configuration is also used by dav-sync. The file is created automaticaly if it doesn't exist.

The config.xml file is an XML file with <configuration> as root element. The <configuration> element can have the following child elements: <repository>, <http-proxy>, <https-proxy>, <key>

repository

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/copy.html --- a/docs/html/copy.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/copy.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav copy @@ -64,7 +64,9 @@
-

dav copy

+

copy [-pcO] [-L <lock>] <url1> <url2>

Creates a duplicate of the resource identified by url1 at the location url2. All resource properties are copied. Currently url1 and url2 must be the same host.

If url1 is a collection, all children are copied.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/date.html --- a/docs/html/date.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/date.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav date @@ -64,7 +64,9 @@
-

dav date

+

date [url]

The purpose of this command is to get the current date from a server and print it to stdout (HTTP date format). This in useful in combination with the -u option for the list and get command.

The url can be any http url. If no url is specified, the local time is used.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/delete-conflicts.html --- a/docs/html/delete-conflicts.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/delete-conflicts.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav-sync delete-conflicts @@ -64,7 +64,9 @@
-

dav-sync delete-conflicts

+

delete-conflicts <directory>

Deletes all files that are marked as a conflict. This will always delete the files and does not move them to the trash directory.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/empty-trash.html --- a/docs/html/empty-trash.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/empty-trash.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav-sync empty-trash @@ -64,7 +64,9 @@
-

dav-sync empty-trash

+

empty-trash <directory>

Removes all files from the trash directory of the given sync-directory.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/encryption.html --- a/docs/html/encryption.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/encryption.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + Encryption @@ -64,7 +64,9 @@
-

Encryption

+

The davutils programs have an integrated client-side encryption feature, that allows you to encrypt and decrypt on the fly with AES256 or AES128. To use this feature, the server must support WebDAV dead properties.

The tools support both, encryption of the resource content and encryption of the resource name. Each resource is encrypted separately. With activated name encryption, the actual resource name is disguised by a random name but the name used by the client is stored encrypted as a WebDAV property. This means, an attacker can see the directory structure and the file length, but can't guess the file names and in particular which files have the same name.

To enable encryption a key must be configured in $HOME/.dav/config.xml. A key must have a unique name. To access encrypted resources, all clients must configure the same key with the same name. Currently a key can only be loaded from a file and not generated from a password.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/get-property.html --- a/docs/html/get-property.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/get-property.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav get-property @@ -64,7 +64,9 @@
-

dav get-property

+

get-property [-pc] [-n <uri>] <url> <property>

Gets a specific resource property. Every WebDAV property has a name and an XML namespace. A namespace can be specified with the -n option or with a prefixed name. The prefix and property name are separated by a : as usual.

Example: D:creationdate

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/get.html --- a/docs/html/get.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/get.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav get @@ -64,7 +64,9 @@
-

dav get

+

get [-pcR] [-o <file>] [-u <date>] <url>

Downloads a resource. This command also downloads collections and its child resources when the -R option is used. When downloading a single resource, the default local file name is the resource name. When downloading collections, it does not create a local directory with the collection's name and places its children in there, but it downloads the children directly to the current working directory.

-p disable file name and content decryption. You get exactly what is stored on the server.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/getting-started.html --- a/docs/html/getting-started.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/getting-started.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + Getting started @@ -64,7 +64,9 @@
-

Getting started

+

Test

After successful installation you can test dav with your WebDAV server.

dav list http://example.com/webdav/
diff -r 3070d72f54af -r 0e36bb75a732 docs/html/info.html --- a/docs/html/info.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/info.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav info @@ -64,7 +64,9 @@
-

dav info

+

info [-pc] <url>

Prints some information and lists all properties for the resource specified by url.

Example 1: info of a collection

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/introduction.html --- a/docs/html/introduction.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/introduction.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + Introduction to dav-sync @@ -64,7 +64,77 @@
+ +

The dav-sync program can synchronize a local directory with a WebDAV collection.

+

First Steps

+

To use dav-sync it is required to configure a repository in config.xml and the directory in sync.xml.

+

Create a repository with dav add-repository. Unlike dav, dav-sync is not interactive and never shows an authentication prompt. Therefore the user and password must be specified if the server requires authentication.

+
$ dav add-repository
+Each repository must have an unique name.
+name: myfirstrepo
 
+Specify the repository base url.
+url: http://example.com/webdav/
+
+User for HTTP authentication.
+user (optional): myuser
+password (optional): 
+

After the repository is created, configure a sync-directory with dav-sync add-directory.

+
$ dav-sync add-directory
+Each sync directory must have an unique name.
+name: mysyncdir
+Enter local directory path.
+path: $HOME/important_files
+Specify webdav repository.
+0) myfirstrepo
+1) anotherrepo
+repository: 0
+Enter collection relative to the repository base url.
+collection (default: /): /important_files
+

The specified name is just an identifier and will be used with other dav-sync commands like pull and push.

+

After the configuration is created, you can synchronize your files. There are two commands for it: pull and push.

+

With pull you can apply all changes on the server to your local directory. The command scans the server and detects modified files and which files are deleted. All modified files will be downloadet and all deleted files will be locally removed (or moved to the trash directory). The first time you will run pull for a directory this will just download all files from the WebDAV collection.

+

You can run the pull command with:

+
dav-sync pull mysyncdir
+

The push command scans your local directory for changes, uploads all modified files and removes all locally deleted files from the server.

+
dav-sync push mysyncdir
+

Database

+

Every sync-directory has a database xml file that contains the etag and last modified date of each file. The etag is used to detect changes on the server and the last modified date is used to detect local changes. The database file is usually located in $HOME/.dav/ and if you want to reset a sync-directory, you can delete the database. After that, pull/push (with disabled conflict detection) will download/upload all files.

+

Conflict detection

+

The pull and push commands detect if a file has changed remotely and locally. This is a conflict that must be resolved manually.

+

When pull detects a conflict it renames the local file to orig-$number.$name where $number is an integer, usually 0 if no other conflict file with the name exists and $name is the file's name. After the file is renamed the new file from the server is downloadet. The user should merge the files manually then or just delete one or keep both. After that run resolve-conflicts to remove all conflict entries from the database otherwise push will ignore any file in a conflict state. There is also the delete-conflicts command that deletes all conflict files.

+

When push detects that a file is modified locally and on the server, it just skips this file. Run the pull command to get the new file from the server and resolve the conflict like described above.

+

Trash

+

For high data safety, a trash directory can be configured. If this is done, dav-sync will not delete files, but move them to the trash directory. Also the pull command can move files to the trash directory before overwriting them.

+

To enable the trash, add the <trash> element to the directory config. The trash path can be absolute or relative to the sync-directory path.

+
<directory>
+    <name>mydir</name>
+    <path>$HOME/myfiles</path>
+    <repository>myrepo</repository>
+    <database>mydir-db.xml</database>
+    
+    <!-- enable trash dir -->
+    <trash>.trash</trash>
+</directory>
+

Files inside the trash directory will not be synchronized with the server.

+

Add the <backup-on-pull> element if you want to backup files to the trash directory before they are overwritten.

+
<directory>
+    ...
+    
+    <backup-on-pull>true</backup-on-pull>
+<directory>
+

Locking

+

It is highly recommended to lock the repository if it is expected that multiple users want to access and modify the repository simultaneously. Locking can be enabled with the -l option when using the pull or push command, or it can be permanently enabled in sync.xml for a directory with the <lock-pull> and <lock-push> elements.

+
<directory>
+    ...
+    <lock-pull>true</lock-pull>
+    <lock-push>true</lock-push>
+</directory>
+

See Configuration for details.

+

Encryption

+

The dav-sync program uses the same repository settings as dav. If encryption is enabled for a repository, dav-sync stores files encrypted on the server. See Encryption for details.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/list-directories.html --- a/docs/html/list-directories.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/list-directories.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav-sync list-directories @@ -64,7 +64,9 @@
-

dav-sync list-directories

+

This command lists all configured sync-directories.

Command alias: list-dirs

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/list-repositories.html --- a/docs/html/list-repositories.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/list-repositories.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav list-repositories @@ -64,7 +64,9 @@
-

dav list-repositories

+

This command lists all configured repositories.

Command alias: list-repos

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/list.html --- a/docs/html/list.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/list.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav list @@ -64,7 +64,9 @@
-

dav list

+

dav list [-altepcR] [-u <date>] <url>

Lists child resources of the specified collection. Without any option it shows only the direct children and hides files beginning with a dot. The behavior is quite similar to that of the unix tool ls.

Options

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/lock.html --- a/docs/html/lock.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/lock.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav lock @@ -64,7 +64,9 @@
-

dav lock

+

lock [-pc] <url>

Creates a lock on the resource specified by the url. The lock is an exclusive write lock with infinite depth.

If the resource is successfully locked, a lock token for this resource is printed to stdout. This lock token should be saved somewhere to unlock the resource eventually.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/mkdir.html --- a/docs/html/mkdir.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/mkdir.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav mkdir @@ -64,7 +64,9 @@
-

dav mkdir

+

mkdir [-pc] [-k <key>] [-L <lock>] <url>

Creates a collection. All intermediate collections are also created as necessary.

-p disable file name encryption and decryption

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/move.html --- a/docs/html/move.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/move.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav move @@ -64,7 +64,9 @@
-

dav move

+

move [-pcO] [-L <lock>] <url> <url>

Moves the resource identified by url1 to the location url2. Currently url1 and url2 must be on the same host.

If url2 already exists, the command aborts, unless the -O option is specified.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/pull.html --- a/docs/html/pull.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/pull.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav-sync pull @@ -64,7 +64,9 @@
-

dav-sync pull

+

pull [-cld] <directory>

Pulls all changes from the server. All new or modified files are downloaded and all files deleted on the server are deleted locally. If a file is also locally modified and conflict detection is not disabled, the local file is renamed and an entry in the conflict database is added.

When a trash directory is configured for the SyncDirectory, all files that would be deleted are instead moved to the trash directory.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/push.html --- a/docs/html/push.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/push.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav-sync push @@ -64,7 +64,9 @@
-

dav-sync push

+

push [-cld] <directory>

Pushes all local changes to the server. This uploads all locally modified files and deletes all locally deleted files on the server.

If conflict detection is not disabled, all files that are also modified on the server will be skipped.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/put.html --- a/docs/html/put.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/put.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav put @@ -64,7 +64,9 @@
-

dav put

+

put [-pcR] [-k <key>] [-L <lock>] <url> <file>

Uploads a file or a directory. When uploading a file while the url points to an existing collection, a resource inside this collection with the file's name is created. When the url points to a non-existing resource, the resource is created.

When uploading a directory, you need to specify the -R option. It uploads all files in the directory to the specified url, but it does not create a collection for the directory itself. You may use dav mkdir to create this collection beforehand.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/remove.html --- a/docs/html/remove.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/remove.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav remove @@ -64,7 +64,9 @@
-

dav remove

+

remove [-pc] [-L <lock>] <url>

Removes a resource. When removing a collection, all child resources are also removed.

-p disable file name and path decryption if enabled

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/resolve-conflicts.html --- a/docs/html/resolve-conflicts.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/resolve-conflicts.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav-sync resolve-conflicts @@ -64,7 +64,9 @@
-

dav-sync resolve-conflicts

+

resolve-conflicts <directory>

Removes conflict entries from the database. This does not merge any files. All files which are marked as conflict are normal files after running this command. In other words: by executing this command you assert that you have resolved the conflicts.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/set-property.html --- a/docs/html/set-property.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/set-property.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav set-property @@ -64,7 +64,9 @@
-

dav set-property

+

set-property [-pc] [-L <lock>] [-n <uri>] <url> <property> [value]

Sets a resource property to the specified value.

property is a property name with or without prefix (see get-property for details).

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/sync-check-config.html --- a/docs/html/sync-check-config.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/sync-check-config.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav-sync check-config @@ -64,7 +64,9 @@
-

dav-sync check-config

+

Validates the sync.xml file. If the configuration is OK, it prints Configuration OK. to stdout and returns 0, otherwise it prints an error message to stderr and returns 1.

Command alias: check

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/sync-commands.html --- a/docs/html/sync-commands.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/sync-commands.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + Commands @@ -64,13 +64,15 @@
-

Commands

+

All commands expect a <directory> argument, which is the identifer of a local directory that should be synchronized. The directory must be configured in sync.xml. See Configuration.

Common Commands

Get resources from the server, which are modified since last sync:

-
dav pull <directory>
+
dav-sync pull <directory>

Upload all locally modified resources:

-
dav push <directory>
+
dav-sync push <directory>
diff -r 3070d72f54af -r 0e36bb75a732 docs/html/sync-configuration.html --- a/docs/html/sync-configuration.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/sync-configuration.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + Configuration @@ -64,7 +64,82 @@
- + +

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>, <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>

+

filter

+

With the filter element, include and exclude filters can be specified, to control which files are synchronized. The pull and push 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.

+

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

+

Optional elements: <include>, <exclude>

+

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>
diff -r 3070d72f54af -r 0e36bb75a732 docs/html/trash-info.html --- a/docs/html/trash-info.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/trash-info.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav-sync trash-info @@ -64,7 +64,9 @@
-

dav-sync trash-info

+

trash-info <directory>

Shows the trash directory path for a sync-directory, the number of files currently in trash and the space they consume.

diff -r 3070d72f54af -r 0e36bb75a732 docs/html/unlock.html --- a/docs/html/unlock.html Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/html/unlock.html Sun Aug 06 14:41:20 2017 +0200 @@ -4,7 +4,7 @@ - + dav unlock @@ -64,7 +64,9 @@
-

dav unlock

+

unlock [-pc] [-L <lock>] <url>

Unlocks the specified url with a lock token. If no lock token is specified with the -L option, it read from stdin.

-p disable file name and path decryption if enabled

diff -r 3070d72f54af -r 0e36bb75a732 docs/src/add-directory.md --- a/docs/src/add-directory.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/add-directory.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav-sync add-directory -====================== +--- +title: 'dav-sync add-directory' +--- This command runs an interactive assistant that creates a [sync-directory configuration][1] and adds it to the sync.xml file. Before running this command, a repository must be created. See [dav add-repository][2]. diff -r 3070d72f54af -r 0e36bb75a732 docs/src/add-repository.md --- a/docs/src/add-repository.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/add-repository.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav add-repository -================== +--- +title: 'dav add-repository' +--- This command runs an interactive assistant that creates a repository [configuration][1] and adds it to the config.xml file. diff -r 3070d72f54af -r 0e36bb75a732 docs/src/check-config.md --- a/docs/src/check-config.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/check-config.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav check-config -================ +--- +title: 'dav check-config' +--- Validates the config.xml file. If the config is ok, it prints `Configuration OK.` to stdout and returns 0, otherwise it prints an error message to stderr and returns 1. diff -r 3070d72f54af -r 0e36bb75a732 docs/src/check-repositories.md --- a/docs/src/check-repositories.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/check-repositories.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav-sync check-repositories -=========================== +--- +title: 'dav-sync check-repositories' +--- Checks if every repository used by sync-directories is configured and available. This command outputs the status for each repository. diff -r 3070d72f54af -r 0e36bb75a732 docs/src/commands.md --- a/docs/src/commands.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/commands.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -Commands -======== +--- +title: 'Commands' +--- Overview -------- diff -r 3070d72f54af -r 0e36bb75a732 docs/src/configuration.md --- a/docs/src/configuration.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/configuration.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -Configuration -============= +--- +title: 'Configuration' +--- The main configuration file for *dav* is `$HOME/.dav/config.xml` and is used for configuring repositories, proxies and encryption keys. This configuration is also used by *dav-sync*. The file is created automaticaly if it doesn't exist. diff -r 3070d72f54af -r 0e36bb75a732 docs/src/copy.md --- a/docs/src/copy.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/copy.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav copy -======== +--- +title: 'dav copy' +--- **`copy [-pcO] [-L ] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/date.md --- a/docs/src/date.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/date.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav date -======== +--- +title: 'dav date' +--- **`date [url]`** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/delete-conflicts.md --- a/docs/src/delete-conflicts.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/delete-conflicts.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav-sync delete-conflicts -========================== +--- +title: 'dav-sync delete-conflicts' +--- **`delete-conflicts `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/empty-trash.md --- a/docs/src/empty-trash.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/empty-trash.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav-sync empty-trash -==================== +--- +title: 'dav-sync empty-trash' +--- **`empty-trash `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/encryption.md --- a/docs/src/encryption.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/encryption.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -Encryption -========== +--- +title: 'Encryption' +--- The davutils programs have an integrated client-side encryption feature, that allows you to encrypt and decrypt on the fly with AES256 or AES128. To use this feature, the server **must** support WebDAV dead properties. diff -r 3070d72f54af -r 0e36bb75a732 docs/src/get-property.md --- a/docs/src/get-property.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/get-property.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav get-property -================ +--- +title: 'dav get-property' +--- **`get-property [-pc] [-n ] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/get.md --- a/docs/src/get.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/get.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav get -======= +--- +title: 'dav get' +--- **`get [-pcR] [-o ] [-u ] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/getting-started.md --- a/docs/src/getting-started.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/getting-started.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -Getting started -=============== +--- +title: 'Getting started' +--- ### Test diff -r 3070d72f54af -r 0e36bb75a732 docs/src/info.md --- a/docs/src/info.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/info.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav info -======== +--- +title: 'dav info' +--- **`info [-pc] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/introduction.md --- a/docs/src/introduction.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/introduction.md Sun Aug 06 14:41:20 2017 +0200 @@ -0,0 +1,125 @@ +--- +title: 'Introduction to dav-sync' +--- + +The dav-sync program can synchronize a local directory with a WebDAV collection. + +First Steps +----------- + +To use dav-sync it is required to configure a repository in [config.xml][1] and the directory in [sync.xml][2]. + +Create a repository with [dav add-repository][3]. Unlike *dav*, *dav-sync* is not interactive and never shows an authentication prompt. Therefore the user and password **must** be specified if the server requires authentication. + + $ dav add-repository + Each repository must have an unique name. + name: myfirstrepo + + Specify the repository base url. + url: http://example.com/webdav/ + + User for HTTP authentication. + user (optional): myuser + password (optional): + +After the repository is created, configure a sync-directory with [dav-sync add-directory][4]. + + $ dav-sync add-directory + Each sync directory must have an unique name. + name: mysyncdir + Enter local directory path. + path: $HOME/important_files + Specify webdav repository. + 0) myfirstrepo + 1) anotherrepo + repository: 0 + Enter collection relative to the repository base url. + collection (default: /): /important_files + +The specified name is just an identifier and will be used with other dav-sync commands like *pull* and *push*. + +After the configuration is created, you can synchronize your files. There are two commands for it: *pull* and *push*. + +With *pull* you can apply all changes on the server to your local directory. The command scans the server and detects modified files and which files are deleted. All modified files will be downloadet and all deleted files will be locally removed (or moved to the trash directory). The first time you will run *pull* for a directory this will just download all files from the WebDAV collection. + +You can run the *pull* command with: + + dav-sync pull mysyncdir + +The *push* command scans your local directory for changes, uploads all modified files and removes all locally deleted files from the server. + + dav-sync push mysyncdir + +[1]: ./configuration.html +[2]: ./sync-configuration.html +[3]: ./add-repository.html +[4]: ./add-directory.html + + +Database +-------- + +Every sync-directory has a database xml file that contains the etag and last modified date of each file. The etag is used to detect changes on the server and the last modified date is used to detect local changes. The database file is usually located in *$HOME/.dav/* and if you want to reset a sync-directory, you can delete the database. After that, *pull*/*push* (with disabled conflict detection) will download/upload all files. + + +Conflict detection +------------------ + +The *pull* and *push* commands detect if a file has changed remotely and locally. This is a conflict that must be resolved manually. + +When *pull* detects a conflict it renames the local file to *orig-\$number.\$name* where *\$number* is an integer, usually 0 if no other conflict file with the name exists and *\$name* is the file's name. After the file is renamed the new file from the server is downloadet. The user should merge the files manually then or just delete one or keep both. After that run *resolve-conflicts* to remove all conflict entries from the database otherwise *push* will ignore any file in a conflict state. There is also the *delete-conflicts* command that deletes all conflict files. + +When *push* detects that a file is modified locally and on the server, it just skips this file. Run the *pull* command to get the new file from the server and resolve the conflict like described above. + + + +Trash +----- + +For high data safety, a trash directory can be configured. If this is done, dav-sync will not delete files, but move them to the trash directory. Also the pull command can move files to the trash directory before overwriting them. + +To enable the trash, add the `` element to the directory config. The trash path can be absolute or relative to the sync-directory path. + + + mydir + $HOME/myfiles + myrepo + mydir-db.xml + + + .trash + + +Files inside the trash directory will not be synchronized with the server. + +Add the `` element if you want to backup files to the trash directory before they are overwritten. + + + ... + + true + + + +Locking +------- + +It is highly recommended to lock the repository if it is expected that multiple users want to access and modify the repository simultaneously. Locking can be enabled with the `-l` option when using the *pull* or *push* command, or it can be permanently enabled in *sync.xml* for a directory with the `` and `` elements. + + + ... + true + true + + +See [Configuration][5] for details. + +[5]: ./configuration.html + +Encryption +---------- + +The *dav-sync* program uses the same repository settings as *dav*. If encryption is enabled for a repository, *dav-sync* stores files encrypted on the server. See [Encryption][6] for details. + +[6]: ./encryption.html + diff -r 3070d72f54af -r 0e36bb75a732 docs/src/list-directories.md --- a/docs/src/list-directories.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/list-directories.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav-sync list-directories -===================== +--- +title: 'dav-sync list-directories' +--- This command lists all configured sync-directories. diff -r 3070d72f54af -r 0e36bb75a732 docs/src/list-repositories.md --- a/docs/src/list-repositories.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/list-repositories.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav list-repositories -===================== +--- +title: 'dav list-repositories' +--- This command lists all configured repositories. diff -r 3070d72f54af -r 0e36bb75a732 docs/src/list.md --- a/docs/src/list.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/list.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav list -======== +--- +title: 'dav list' +--- **`dav list [-altepcR] [-u ] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/lock.md --- a/docs/src/lock.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/lock.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav lock -======== +--- +title: 'dav lock' +--- **`lock [-pc] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/mkdir.md --- a/docs/src/mkdir.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/mkdir.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav mkdir -========= +--- +title: 'dav mkdir' +--- **`mkdir [-pc] [-k ] [-L ] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/move.md --- a/docs/src/move.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/move.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav move -======== +--- +title: 'dav move' +--- **`move [-pcO] [-L ] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/pull.md --- a/docs/src/pull.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/pull.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav-sync pull -============= +--- +title: 'dav-sync pull' +--- **`pull [-cld] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/push.md --- a/docs/src/push.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/push.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav-sync push -============= +--- +title: 'dav-sync push' +--- **`push [-cld] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/put.md --- a/docs/src/put.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/put.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav put -======= +--- +title: 'dav put' +--- **`put [-pcR] [-k ] [-L ] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/remove.md --- a/docs/src/remove.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/remove.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav remove -========== +--- +title: 'dav remove' +--- **`remove [-pc] [-L ] `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/resolve-conflicts.md --- a/docs/src/resolve-conflicts.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/resolve-conflicts.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav-sync resolve-conflicts -========================== +--- +title: 'dav-sync resolve-conflicts' +--- **`resolve-conflicts `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/set-property.md --- a/docs/src/set-property.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/set-property.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav set-property -================ +--- +title: 'dav set-property' +--- **`set-property [-pc] [-L ] [-n ] [value]`** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/sync-check-config.md --- a/docs/src/sync-check-config.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/sync-check-config.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav-sync check-config -===================== +--- +title: 'dav-sync check-config' +--- Validates the sync.xml file. If the configuration is OK, it prints `Configuration OK.` to stdout and returns 0, otherwise it prints an error message to stderr and returns 1. diff -r 3070d72f54af -r 0e36bb75a732 docs/src/sync-commands.md --- a/docs/src/sync-commands.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/sync-commands.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -Commands -======== +--- +title: 'Commands' +--- All commands expect a `` argument, which is the identifer of a local directory that should be synchronized. The directory must be configured in sync.xml. See [Configuration][1]. @@ -10,10 +11,10 @@ Get resources from the server, which are modified since last sync: - dav pull + dav-sync pull Upload all locally modified resources: - dav push + dav-sync push diff -r 3070d72f54af -r 0e36bb75a732 docs/src/sync-configuration.md --- a/docs/src/sync-configuration.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/sync-configuration.md Sun Aug 06 14:41:20 2017 +0200 @@ -0,0 +1,127 @@ +--- +title: 'Configuration' +--- + +The file `$HOME/.dav/sync.xml` is used for configuring sync-directories. + +The *sync.xml* file is an XML file with `` as root element. This element can only have `` 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: ``, ``, ``, `` \ +Optional elements: ``, ``, ``, ``, ``, ``, `` + +### name + +Unique sync-directory identifer. This identifer is used in combination with all *dav-sync* commands. + +Type: string \ +Example: `mysyncdir` + +### repository + +Name of the WebDAV-repository. A repository with the same name must be configured in [config.xml][1]. + +Type: string \ +Example: `myrepo` + +### 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: + + `$HOME/Documents` + +The part between `$` and `/` is the environment variable name. + +Type: string \ +Example: `/absolute/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: `myrepo-db.xml` + +### 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: `/myfiles` + +### 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` + +### 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: `3` + +### 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: `true` + +### lock-pull + +Enables locking for the *pull* command. + +Type: boolean \ +Default: false \ +Example: `true` + +### lock-push + +Enables locking for the *push* command. + +Type: boolean \ +Default: false \ +Example: `true` + +### filter + +With the filter element, include and exclude filters can be specified, to control which files are synchronized. The *pull* and *push* 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. + +Note: The file path is relative to the directory path (and WebDAV collection) but always starts with an path separator. + +Optional elements: ``, `` + +### 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: + + + \.pdf$ + + +### exclude + +Controls which files will be excluded by *pull* and *push*. + +Type: regex string \ +Example: + + + ^/secretdir + \.DS_Store$ + + + diff -r 3070d72f54af -r 0e36bb75a732 docs/src/trash-info.md --- a/docs/src/trash-info.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/trash-info.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav-sync trash-info -=================== +--- +title: 'dav-sync trash-info' +--- **`trash-info `** diff -r 3070d72f54af -r 0e36bb75a732 docs/src/unlock.md --- a/docs/src/unlock.md Sat Aug 05 13:35:27 2017 +0200 +++ b/docs/src/unlock.md Sun Aug 06 14:41:20 2017 +0200 @@ -1,5 +1,6 @@ -dav unlock -========== +--- +title: 'dav unlock' +--- **`unlock [-pc] [-L ] `**