Re

Get WebDAV-Sync at SourceForge.net. Fast, secure and Free Open Source software downloads

DAVbox, WebDAV synchronization for the desktop

Manual

Run the binary as follows, using Java 1.7 or higher:

  java -jar webdav_sync.jar [-h] [-i seconds] [-reset] \
    (-c config_file | [(-r|-no-recursion)] [-rename] \
    [-rename-depth number] [-hidden-folder] \
    [(-e|-inc) comma_separated_patterns] [-https-protocols value] [-force] \
    (-down|-up|-bi) -u URL -d directory)
-h
Writes the command synopsis on the terminal.
-r
Recurs into empty directories. This is only useful if the server doesn't support "infinity" for the WebDAV "Depth" header or if you are not in a position to turn it on. A server may correctly report the fact that it doesn't support this, in which case you don't need the option because the recursion will be done automatically.
-no-recursion
Prohibits recursion into subdirectories, even if the server supports recursion.
-i
An interval in seconds. When set the tool loops forever and executes the synchronization every interval.
-c
A configuration file with the following form:
    <?xml version="1.0"?>
    <config>
      <sync>
        <directory>dir</directory>
        <url>https://...</url>
        <direction>down</direction>
        <force>true</force>
        <!-- Optional ACL for upload. -->
        <acl xmlns="DAV:">
          <ace>
            <principal><authenticated/></principal>
            <grant>
              <privilege><read/></privilege>
            </grant>
          </ace>
        </acl>
        <exclude>filename pattern 1</exclude>
        <exclude>filename pattern 2</exclude>
        <rename/>
        <rename-depth>10<rename-depth>
        <hidden-folder-name>.Hidden<hidden-folder-name>
        <!-- The following two are mutually exclusive. -->
        <recursive/>
        <no-recursion/>
        ...
      </sync>
      ...
    </config>

See RFC 3744 for the ACL syntax.

-e
An optional comma-separated list of filename patterns. Files that match a pattern are excluded from the synchronization. If the string is surrounded by square brackets it is interpreted as a regular expression.
-inc
An optional comma-separated list of filename patterns. Files that match a pattern are retained for the synchronization. The others are excluded. If the string is surrounded by square brackets it is interpreted as a regular expression.
-down|-up|-bi
The synchronization direction. Updates and deletions are propagated to the other side. Server renames may be detected if the ETag header is consistent.
-u
The URL.
-d
The local directory.
-rename
Renames files instead of overwriting them. Files are renamed with suffixes .1, .2 and so on, up to the rename depth. This happens locally as well as on the server.
-rename-depth
The number of versions kept when renaming files.
-hidden-folder
The name of the hidden folder that is created in each folder, locally and on the server, when files or folders have to be deleted. When this option is on they are moved into the hidden folder that is in the same folder.
-reset
Remove the synchronization history prior to the synchronization, which makes it look like an initial synchronization.
-https-protocols
The value for the system property https.protocols. Its value is something like TLSv1,TLSv1.1,TLSv1.2.
-force
When there are conflicts at up and down synchronizations this option forces the resolution to be in favour of the source side.

Use it as an Ant task through the taskdef element:

  <taskdef
    name="webdav-sync"
    classname="be.re.webdav.cmd.SyncAntTask"
    classpath="<directory>/webdav_sync.jar" />

The Ant task has the following parameters:

directory (mandatory)
Corresponds to the -d option.
url (mandatory)
Corresponds to the -u option.
direction (mandatory)
Can be down, up or bi. It corresponds to the -down, -up and -bi options.
recur
Either true or false. It corresponds to the -r option.
excludes
Corresponds to the -e option.
rename
Corresponds to the -rename option.
rename-depth
Corresponds to the -rename-depth option.
hidden-folder-name
Corresponds to the -hidden-folder option.

The URL might require a username and a password. You can specify it in the URL like this: https://username:password@hostname/.... Note that if the username or the password contain characters that must not appear in the URL at that place, they should be escaped using URI-encoding. For example, @ should be %40, : becomes %3a, etc. See also http://en.wikipedia.org/wiki/Percent-encoding.

A safer method is to configure it with UIVI. On the Settings tab go to the subtab URL Authentications and append a row with the pop-up menu.

A non-compliant server might respond with a Bad Request. This usually means it doesn't support compression, but responds with a 400 instead of a 415, which is what normal content negotiation prescribes. You can add -Dbe.re.http.no-compress to the beginning of the command-line and file a bug report at the provider of your server.

Some servers don't support the 100-continue feature, but fail to report this with a 417 status code. In that case you can add -Dbe.re.http.no-expect100 to the beginning of the command-line.

It may happen that you get an error message like the following when using HTTPS:

sun.security.validator.ValidatorException: PKIX path
building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target

This can occur when an root or intermediate certificate is not available in the Java enviroment. Or you would like to use a self-signed certificate. It is possible to add these to the cacerts file. This is an example of how you can do it on Ubuntu:

# save my certificate to a file

echo -n | openssl s_client -showcerts -connect SERVER.TLD:443 | sed -ne
'/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' >
/home/USERNAME/my-certificate.crt

# import into Java CAcerts (Ubuntu path)

sudo keytool -import -trustcacerts -keystore /etc/ssl/certs/java/cacerts
-storepass changeit -noprompt -alias MY-OWN-CA-NAME -file
/home/USERNAME/my-certificate.crt

You can also launch UIVI and connect to the server. It will ask to trust the certificate and if you do it permanently it will create a trust store WebDAV-Sync will also use.

When running on the command-line the following exit codes are returned:

0
For successful completion.
1
In case of a general error.
2
When there is a connection problem.
3
When there are conflicts after the synchronization.
10
When authentication fails.
11
When authorization fails.
12
When the collection on the server doesn't exist.
20
In case of any other HTTP-error.