Files
syncthing/draft/selective.rst
T

123 lines
3.6 KiB
ReStructuredText
Raw Normal View History

2015-06-11 08:19:03 +02:00
.. note:: This describes an incomplete feature under development.
2015-06-10 17:39:47 +02:00
Selective Sync
==============
This is for when you don't want to synchronize *all* files from the cluster
2015-10-08 22:06:15 +05:45
onto your device, or you want only some directories of yours to be synced
2015-06-10 17:39:47 +02:00
*to* the cluster. There are two mechanisms that support this usage; *Directory
Selection* and *Excluded Files*.
2015-06-11 08:19:03 +02:00
2015-06-10 17:39:47 +02:00
Directory Selection
-------------------
By default, all directories in a given folder are synchronized. Using
directory selection, the synchronization can be limited to a subset of
directories. The selection is done by using a tree browser. The tree
represents the cluster wide contents of a folder. The default is represented
by the top level being checked and directories underneath the top level thus
being implicitly included::
[X] ~/Sync
[ ] Documents
[ ] Processes
[ ] Standards
[ ] Pictures
[ ] Vacation
[ ] Work
[ ] Music
[ ] Classical
[ ] Rock
To only synchronize documents and vacation pictures, the following selection can be made::
[/] ~/Sync
[X] Documents
[ ] Processes
[ ] Standards
2015-06-11 10:13:21 +01:00
[/] Pictures
2015-06-10 17:39:47 +02:00
[X] Vacation
[ ] Work
[ ] Music
[ ] Classical
[ ] Rock
The top level shows a partial checkbox to indicate that selections have been
made at a lower level. With this configuration Syncthing will ignore any files
and directories no in ~/Sync/Documents or ~/Sync/Pictures/Vacation -- no
changes will be downloaded from the cluster and local changes will not be
tracked.
2015-06-11 08:19:03 +02:00
.. note:: When displaying the tree we must merge what we actually have on disk
2015-10-08 22:06:15 +05:45
with what is in the global state, or we will not be able to show new
2015-06-11 08:19:03 +02:00
directories to the user as we don't know about them...
2015-06-10 17:39:47 +02:00
Excluded Files
--------------
In addition to using directory selection, specific files can be excluded by
adding patterns to match them. Excluded files are:
- Ignored when found on disk (i.e. not hashed and not announced to other
devices).
- Ignored when announced by other devices (i.e. will not contribute to an "out
of sync" status or be fetched from the network).
- *Removed* when present in a directory that is marked for deletion by another
2015-06-11 10:13:21 +01:00
device.
2015-06-10 17:39:47 +02:00
Patterns are in "glob" form, with the following allowed syntax elements:
Asterisk (``*``)
Matches zero or more characters.
Question mark (``?``)
Matches exactly one character.
Ranges (``[a-f]``)
Matches any of the characters in the range exactly once.
2015-06-11 08:19:03 +02:00
Exclamation mark (``!``)
At the start of a pattern, inverts the pattern (i.e. make matched file *not* be excluded).
2015-06-10 17:39:47 +02:00
Examples:
``*.jpg``
Matches all files with the ``jpg`` extension.
``[0-9]*``
Matches all files with names starting with a digit.
2015-06-11 08:19:03 +02:00
``!*.doc``
Do not exclude ``.doc`` files.
2015-06-10 17:39:47 +02:00
File exclusions apply only to files, not to directories, and apply equally in
2015-06-11 08:19:03 +02:00
all directories in the folder. Patterns are searched in the order given and
the first match wins.
Use Cases
---------
Sync only specific directories
This is covered perfectly by the "directory selection" part
Exclude common crap files like Thumbs.db
This is covered perfectly by the "excluded files" part
Sync only a specific file type
Covered by ``!``-pattern plus exclude everything
Exclude a specific directory only
Possible by using directory selection and selecting all other directories.
2015-06-10 17:39:47 +02:00
2015-06-11 08:19:03 +02:00
Sync only a specific file in a specific directory; i.e. only one movie out of lots
Not really possible... Do we need this?
2015-06-11 09:15:53 +02:00
2015-06-11 10:13:21 +01:00
Syncing ignore and exclusion patterns between devices
2015-06-11 09:15:53 +02:00
Not supported. However not impossible in the future, given that we store the above in the config.