|
@@ -1,6 +1,6 @@
|
|
.\" Man page generated from reStructuredText.
|
|
.\" Man page generated from reStructuredText.
|
|
.
|
|
.
|
|
-.TH BORG-PATTERNS 1 "2017-05-17" "" "borg backup tool"
|
|
|
|
|
|
+.TH BORG-PATTERNS 1 "2017-06-18" "" "borg backup tool"
|
|
.SH NAME
|
|
.SH NAME
|
|
borg-patterns \- Details regarding patterns
|
|
borg-patterns \- Details regarding patterns
|
|
.
|
|
.
|
|
@@ -34,16 +34,17 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
.sp
|
|
.sp
|
|
File patterns support these styles: fnmatch, shell, regular expressions,
|
|
File patterns support these styles: fnmatch, shell, regular expressions,
|
|
path prefixes and path full\-matches. By default, fnmatch is used for
|
|
path prefixes and path full\-matches. By default, fnmatch is used for
|
|
-\fI\-\-exclude\fP patterns and shell\-style is used for \fI\-\-pattern\fP\&. If followed
|
|
|
|
-by a colon (\(aq:\(aq) the first two characters of a pattern are used as a
|
|
|
|
|
|
+\fB\-\-exclude\fP patterns and shell\-style is used for the experimental \fB\-\-pattern\fP
|
|
|
|
+option.
|
|
|
|
+.sp
|
|
|
|
+If followed by a colon (\(aq:\(aq) the first two characters of a pattern are used as a
|
|
style selector. Explicit style selection is necessary when a
|
|
style selector. Explicit style selection is necessary when a
|
|
non\-default style is desired or when the desired pattern starts with
|
|
non\-default style is desired or when the desired pattern starts with
|
|
two alphanumeric characters followed by a colon (i.e. \fIaa:something/*\fP).
|
|
two alphanumeric characters followed by a colon (i.e. \fIaa:something/*\fP).
|
|
-.sp
|
|
|
|
-\fI\%Fnmatch\fP, selector \fIfm:\fP
|
|
|
|
.INDENT 0.0
|
|
.INDENT 0.0
|
|
-.INDENT 3.5
|
|
|
|
-This is the default style for \-\-exclude and \-\-exclude\-from.
|
|
|
|
|
|
+.TP
|
|
|
|
+.B \fI\%Fnmatch\fP, selector \fIfm:\fP
|
|
|
|
+This is the default style for \fB\-\-exclude\fP and \fB\-\-exclude\-from\fP\&.
|
|
These patterns use a variant of shell pattern syntax, with \(aq*\(aq matching
|
|
These patterns use a variant of shell pattern syntax, with \(aq*\(aq matching
|
|
any number of characters, \(aq?\(aq matching any single character, \(aq[...]\(aq
|
|
any number of characters, \(aq?\(aq matching any single character, \(aq[...]\(aq
|
|
matching any single character specified, including ranges, and \(aq[!...]\(aq
|
|
matching any single character specified, including ranges, and \(aq[!...]\(aq
|
|
@@ -56,23 +57,15 @@ must match from the start to just before a path separator. Except
|
|
for the root path, paths will never end in the path separator when
|
|
for the root path, paths will never end in the path separator when
|
|
matching is attempted. Thus, if a given pattern ends in a path
|
|
matching is attempted. Thus, if a given pattern ends in a path
|
|
separator, a \(aq*\(aq is appended before matching is attempted.
|
|
separator, a \(aq*\(aq is appended before matching is attempted.
|
|
-.UNINDENT
|
|
|
|
-.UNINDENT
|
|
|
|
-.sp
|
|
|
|
-Shell\-style patterns, selector \fIsh:\fP
|
|
|
|
-.INDENT 0.0
|
|
|
|
-.INDENT 3.5
|
|
|
|
|
|
+.TP
|
|
|
|
+.B Shell\-style patterns, selector \fIsh:\fP
|
|
This is the default style for \-\-pattern and \-\-patterns\-from.
|
|
This is the default style for \-\-pattern and \-\-patterns\-from.
|
|
Like fnmatch patterns these are similar to shell patterns. The difference
|
|
Like fnmatch patterns these are similar to shell patterns. The difference
|
|
is that the pattern may include \fI**/\fP for matching zero or more directory
|
|
is that the pattern may include \fI**/\fP for matching zero or more directory
|
|
levels, \fI*\fP for matching zero or more arbitrary characters with the
|
|
levels, \fI*\fP for matching zero or more arbitrary characters with the
|
|
exception of any path separator.
|
|
exception of any path separator.
|
|
-.UNINDENT
|
|
|
|
-.UNINDENT
|
|
|
|
-.sp
|
|
|
|
-Regular expressions, selector \fIre:\fP
|
|
|
|
-.INDENT 0.0
|
|
|
|
-.INDENT 3.5
|
|
|
|
|
|
+.TP
|
|
|
|
+.B Regular expressions, selector \fIre:\fP
|
|
Regular expressions similar to those found in Perl are supported. Unlike
|
|
Regular expressions similar to those found in Perl are supported. Unlike
|
|
shell patterns regular expressions are not required to match the complete
|
|
shell patterns regular expressions are not required to match the complete
|
|
path and any substring match is sufficient. It is strongly recommended to
|
|
path and any substring match is sufficient. It is strongly recommended to
|
|
@@ -81,20 +74,12 @@ separators (\(aq\(aq for Windows and \(aq/\(aq on other systems) in paths are
|
|
always normalized to a forward slash (\(aq/\(aq) before applying a pattern. The
|
|
always normalized to a forward slash (\(aq/\(aq) before applying a pattern. The
|
|
regular expression syntax is described in the \fI\%Python documentation for
|
|
regular expression syntax is described in the \fI\%Python documentation for
|
|
the re module\fP\&.
|
|
the re module\fP\&.
|
|
-.UNINDENT
|
|
|
|
-.UNINDENT
|
|
|
|
-.sp
|
|
|
|
-Path prefix, selector \fIpp:\fP
|
|
|
|
-.INDENT 0.0
|
|
|
|
-.INDENT 3.5
|
|
|
|
|
|
+.TP
|
|
|
|
+.B Path prefix, selector \fIpp:\fP
|
|
This pattern style is useful to match whole sub\-directories. The pattern
|
|
This pattern style is useful to match whole sub\-directories. The pattern
|
|
\fIpp:/data/bar\fP matches \fI/data/bar\fP and everything therein.
|
|
\fIpp:/data/bar\fP matches \fI/data/bar\fP and everything therein.
|
|
-.UNINDENT
|
|
|
|
-.UNINDENT
|
|
|
|
-.sp
|
|
|
|
-Path full\-match, selector \fIpf:\fP
|
|
|
|
-.INDENT 0.0
|
|
|
|
-.INDENT 3.5
|
|
|
|
|
|
+.TP
|
|
|
|
+.B Path full\-match, selector \fIpf:\fP
|
|
This pattern style is useful to match whole paths.
|
|
This pattern style is useful to match whole paths.
|
|
This is kind of a pseudo pattern as it can not have any variable or
|
|
This is kind of a pseudo pattern as it can not have any variable or
|
|
unspecified parts \- the full, precise path must be given.
|
|
unspecified parts \- the full, precise path must be given.
|
|
@@ -109,13 +94,24 @@ If you use such a pattern to include a file, it will always be included
|
|
Other include/exclude patterns that would normally match will be ignored.
|
|
Other include/exclude patterns that would normally match will be ignored.
|
|
Same logic applies for exclude.
|
|
Same logic applies for exclude.
|
|
.UNINDENT
|
|
.UNINDENT
|
|
|
|
+.sp
|
|
|
|
+\fBNOTE:\fP
|
|
|
|
+.INDENT 0.0
|
|
|
|
+.INDENT 3.5
|
|
|
|
+\fIre:\fP, \fIsh:\fP and \fIfm:\fP patterns are all implemented on top of the Python SRE
|
|
|
|
+engine. It is very easy to formulate patterns for each of these types which
|
|
|
|
+requires an inordinate amount of time to match paths. If untrusted users
|
|
|
|
+are able to supply patterns, ensure they cannot supply \fIre:\fP patterns.
|
|
|
|
+Further, ensure that \fIsh:\fP and \fIfm:\fP patterns only contain a handful of
|
|
|
|
+wildcards at most.
|
|
|
|
+.UNINDENT
|
|
.UNINDENT
|
|
.UNINDENT
|
|
.sp
|
|
.sp
|
|
-Exclusions can be passed via the command line option \fI\-\-exclude\fP\&. When used
|
|
|
|
|
|
+Exclusions can be passed via the command line option \fB\-\-exclude\fP\&. When used
|
|
from within a shell the patterns should be quoted to protect them from
|
|
from within a shell the patterns should be quoted to protect them from
|
|
expansion.
|
|
expansion.
|
|
.sp
|
|
.sp
|
|
-The \fI\-\-exclude\-from\fP option permits loading exclusion patterns from a text
|
|
|
|
|
|
+The \fB\-\-exclude\-from\fP option permits loading exclusion patterns from a text
|
|
file with one pattern per line. Lines empty or starting with the number sign
|
|
file with one pattern per line. Lines empty or starting with the number sign
|
|
(\(aq#\(aq) after removing whitespace on both ends are ignored. The optional style
|
|
(\(aq#\(aq) after removing whitespace on both ends are ignored. The optional style
|
|
selector prefix is also supported for patterns loaded from a file. Due to
|
|
selector prefix is also supported for patterns loaded from a file. Due to
|
|
@@ -159,26 +155,25 @@ $ borg create \-\-exclude\-from exclude.txt backup /
|
|
.fi
|
|
.fi
|
|
.UNINDENT
|
|
.UNINDENT
|
|
.UNINDENT
|
|
.UNINDENT
|
|
-.sp
|
|
|
|
A more general and easier to use way to define filename matching patterns exists
|
|
A more general and easier to use way to define filename matching patterns exists
|
|
-with the \fI\-\-pattern\fP and \fI\-\-patterns\-from\fP options. Using these, you may specify
|
|
|
|
-the backup roots (starting points) and patterns for inclusion/exclusion. A
|
|
|
|
-root path starts with the prefix \fIR\fP, followed by a path (a plain path, not a
|
|
|
|
|
|
+with the experimental \fB\-\-pattern\fP and \fB\-\-patterns\-from\fP options. Using these, you
|
|
|
|
+may specify the backup roots (starting points) and patterns for inclusion/exclusion.
|
|
|
|
+A root path starts with the prefix \fIR\fP, followed by a path (a plain path, not a
|
|
file pattern). An include rule starts with the prefix +, an exclude rule starts
|
|
file pattern). An include rule starts with the prefix +, an exclude rule starts
|
|
with the prefix \-, both followed by a pattern.
|
|
with the prefix \-, both followed by a pattern.
|
|
Inclusion patterns are useful to include paths that are contained in an excluded
|
|
Inclusion patterns are useful to include paths that are contained in an excluded
|
|
path. The first matching pattern is used so if an include pattern matches before
|
|
path. The first matching pattern is used so if an include pattern matches before
|
|
an exclude pattern, the file is backed up.
|
|
an exclude pattern, the file is backed up.
|
|
.sp
|
|
.sp
|
|
-Note that the default pattern style for \fI\-\-pattern\fP and \fI\-\-patterns\-from\fP is
|
|
|
|
|
|
+Note that the default pattern style for \fB\-\-pattern\fP and \fB\-\-patterns\-from\fP is
|
|
shell style (\fIsh:\fP), so those patterns behave similar to rsync include/exclude
|
|
shell style (\fIsh:\fP), so those patterns behave similar to rsync include/exclude
|
|
patterns. The pattern style can be set via the \fIP\fP prefix.
|
|
patterns. The pattern style can be set via the \fIP\fP prefix.
|
|
.sp
|
|
.sp
|
|
-Patterns (\fI\-\-pattern\fP) and excludes (\fI\-\-exclude\fP) from the command line are
|
|
|
|
-considered first (in the order of appearance). Then patterns from \fI\-\-patterns\-from\fP
|
|
|
|
-are added. Exclusion patterns from \fI\-\-exclude\-from\fP files are appended last.
|
|
|
|
|
|
+Patterns (\fB\-\-pattern\fP) and excludes (\fB\-\-exclude\fP) from the command line are
|
|
|
|
+considered first (in the order of appearance). Then patterns from \fB\-\-patterns\-from\fP
|
|
|
|
+are added. Exclusion patterns from \fB\-\-exclude\-from\fP files are appended last.
|
|
.sp
|
|
.sp
|
|
-An example \fI\-\-patterns\-from\fP file could look like that:
|
|
|
|
|
|
+An example \fB\-\-patterns\-from\fP file could look like that:
|
|
.INDENT 0.0
|
|
.INDENT 0.0
|
|
.INDENT 3.5
|
|
.INDENT 3.5
|
|
.sp
|
|
.sp
|