Please note that setting up selective sync in a way we describe in this post requires advanced computer management skills. We don’t recommend experimenting with these settings if you are not comfortable with managing apps via command lines. Wrongful setup could cause permanent data loss.
To get help to set up Selective Sync via the Tresorit App please visit this guide.
Advanced Selective Sync will let you create custom synchronization rules. For example, you can select specific file types and exclude them form synchronization: it means that you can prevent certain files being uploaded to the cloud.
How to set it up?
Advanced Sync options can be managed via the files you can find in the hidden .tresorit folder in each synced tresor. This means that changes you make via this method will not get displayed in the application interface.
Create the files that will control the selective synchronization process: under the hidden .tresorit folder in each synced tresor.
- Create the ‘Filters’ folder in the hidden .tresorit folder in the synced tresor you wish to customize.
- Create .tresorit/Filters/roaming.filter
Applies to every user of the tresor, this file is synchronized. It might contain default rules that should apply to every member of the tresor.
- Create .tresorit/Filters/local.filter
Your local filter file. Please note that by modifying this you can overwrite hardcoded (security) rules and default tresor behavior through attributes.
- Please note that by default these are not present: you will have to create the Filters folder and the above mentioned files. The file and folder names must match exactly with the above one. Please pay special attention to upper and lower case letters.
Create custom synchronization rules
Every line of a filter file is a rule, except empty lines and comments. A rule follows this format:
[<List Of Attributes>] <Relative Path>
Comments start with # or // (only at the beginning of the line!).
By defining custom attributes, you can influence the synchronization algorithm of the given relative path in the tresor. The available attributes are:
- Sync – (default) Synchronize the path
- Ignore – Ignore synchronization of the path
- Junk – Ignore synchronization of the path and it may be deleted if neccessary (if the parent directory is deleted from the cloud)
- Remote – (default) use remote timestamps on downloaded files
- Local – use local timestamps on downloaded files
- Normal – (default) use normal thread categories for syncing
- Priority – use a priority thread for syncing
- (default: 3) It is an unsigned integer to influence the priority of the synchronization tasks. Valid values: 1 - 5
Please note that Selective Sync, Deletion and Download are available via the Tresorit apps, therefore we don't support setting these attributes up explicitly from filter files.
The following attributes modify the scope of the rule (which directories and files it applies to)
- File – to match the path for only files
- Directory – to match the path for only directories. If it matches a directory, it will apply to its children recursively as well.
- Unspecified – (default) to match anything. If it matches a directory, it will apply to its children recursively as well.
- False – (default) the path in the rule is considered to be case-insensitive
- True – the path in the rule is considered to be case-sensitive (use this carefully, it's effect can be unexpected when syncing on a case-insensitive file system)
Attribute values formatted with underlined and bold fonts can be used without attribute key.
[Sync=Junk, PathType=File] ...
# is equivalent to
[Junk, File] ...
Default path attributes
Putting together the rules above, the default attributes that apply to all files and folders could be written as:
[Sync, Include, Deletion=Normal, Download=Normal, Merge=Conflict, Date=Remote, Threading=Normal, Priority=3, PathType=Unspecified, CaseSensitive=False] Path
The filter files have a quite simple syntax for defining relative path patterns.
- The easiest way is to enlist the full paths to be modified. Please note that you can use only forward slashes in paths (back slashes are replaced with forward slashes).
- [Ignore] Directory/file.txt
- This rule will exclude this specific file from syncronization.
- To create more complex settings, you can utilize basic rule generation patterns. These rules will make sure that parent directories are handled correctly for recursive synchronization. For example, a selective sync like behavior could be written as
- [Ignore] //*
- [Sync] Foo/Bar
- These two will ignore all files and directories by default, and add a rule for "Foo" directory to be synced and all its children to be ignored, only the "Bar" directory to be synced which will result in syncing only the selected (Foo/Bar) directory.
- You can use (multiple) joker characters with basic rule generation. "//" will match for any subpath and "*" will match for a single path component (everything except "/") Using this method for example:
- [Ignore] //*
- Ignore all files.
- [Sync, File] Directory/*/file.txt
- Sync all direct subdirectories of "Directory" and all "file.txt" files inside them.
- [Sync] A/A*B/C
- Sync all C directories inside directories that match the "A*B" pattern inside the "A" directory.
- [Ignore] //Debug
- This will ignore all Debug directories in the tresor at any depth. This is the rough equivalent of .gitignore
- [Sync, File] //*.config
- Sync all .config files across the tresor.
Rules are processed in order. Thus a rule which is after another one will have higher priority. Rule processing order:
- roaming.filter file is processed,
- Selective sync, mobile favorites are applied by the GUIs (IMPORTANT: this can overwrite all previous SelectiveSync, Deletion, Download rules)
- then hardcoded rules are applied (mostly for ignoring most of the .tresorit directory and temporary files),
- after that local.filter rules are processed.
The hardcoded rules are roughly equivalent to this:
# Ignore synchronization's temp files, local.filter and Trash directory
# Sync the roaming.filter (and the .tresorit/Filters directory, which is necessary)
# Temp files which can be deleted if their containing folder gets deleted
# In the line below \r is a single character
[Junk] //* .tmp
# Other temp files which should not be deleted if their parent directory gets deleted
[Ignore] // Volume Information
Basic information about the synchronization process
Synchronization tasks are created recursively starting from the root of your tresor and directories and files are processed separately. Attributes are checked on each synchronized file and directory path. At any depth we can check the path attributes only if the parents were synchronized as a result of the encryption, for example we do not know if there is an Foo/Bar/baz.txt file (therefore we cannot sync it) unless we sync both Foo and Foo/Bar directories – rule generation takes care of this problem in most use cases.
A file (or directory) is ignored if at least one of Ignore, Junk or Exclude is set.
Thank you so much for your attention. If you have questions or feedback, feel free to contact us.