Files
duplicati/Duplicati/Scheduler/Filters.rtf
T
2011-08-01 03:40:38 +00:00

38 lines
3.5 KiB
Plaintext

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\b\f0\fs22 Introduction\par
\b0 Duplicati supports using filters to provide fine grained control over which files are included and which files are not.\par
This page describes some of the more non-obvious parts of how filters work. \par
\b File globbing vs. regular expressions\b0\par
Internally Duplicati only uses regular expressions to match file and folder names.\par
You can supply filters in the simpler form, known as file globbing or wildcard matching. An example of file globbing / wildcard matching:\par
*.txt\par
Log_no_?.txt\par
This document is not intended to be a guide into regular expressions, but this example shows the above filters with regular expressions:\par
.*\\.txt\par
Log_no_.\\.txt\par
If the two were equivalent, there would be no need to use the more complicated regular expressions, so here is an example of something that cannot be expressed using wildcards:\par
Log_no_[0-9]+\\.txt\par
[(first)|(last)]\\-log\\.txt\par
\b Absolute vs. relative paths\b0\par
Duplicati 1.0 only supports a single source folder, so it is quite simple to obtain the full path given a relative one, and vice versa. However in newer versions of Duplicati, multiple source folders are supported, so this mapping is no longer simple.\par
In Duplicati 1.0, only relative paths are supported. To support the previous versions, relative folders are still supported, but now absolute paths are also supported.\par
\b Directories\b0\par
Internally Duplicati appends the directory separator character ("\\" or "/") to directories to be able to distinguish them from files.\par
When creating a filter, this can be used to match a specific folder, such as (wildcard type):\par
D:\\Downloads\\\par
Note that if the trailing slash is missing, the filter will not match the folder, but rather a file with the same name.\par
\b Filter order\b0\par
Duplicati uses the "first match" method when evaluating filters. This means that if a file or directory matches a filter, that filter determines if the item is included or excluded. No subsequent filters are evaluated. \par
+.*.txt\par
-.*\\\\Thumbs\\\\.db\par
+.*\par
In the above example all files named Thumbs.db will be included even though there is a "catch all" filter that matches all files. The last filter can safely be omitted, as Duplicati automatically includes all files that are not specifically excluded.\par
When filtering a directory, be aware that the directory itself is processed before any files in it. This means that if you exclude a folder, no files in that folder can be included, even if the filter to include them is placed before the folder exclusion filter. Example filesystem contents:\par
D:\\Downloads\\Myfile.txt\par
Example filter setup:\par
Include: *.txt\par
Exclude: D:\\Downloads\\\par
Even though the filter states that the txt file should be included, it is not. When looking for files, Duplicati first discovers the folder, and then determines to exclude the folder. This means that the file is never evaluated.\par
The reason for this is performance. If Duplicati had to run through all excluded folders it would take much longer to complete. Imagine for example that the user has chosen to backup the C drive and excludes the folder "C:\\Windows", on an average system, it could take a few minutes to search that folder and its subfolders.\par
}