|
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
|
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
|
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
|
|
..
|
|
|
-.TH "BORG-PATTERNS" 1 "2022-02-05" "" "borg backup tool"
|
|
|
+.TH "BORG-PATTERNS" 1 "2022-02-19" "" "borg backup tool"
|
|
|
.SH NAME
|
|
|
borg-patterns \- Details regarding patterns
|
|
|
.SH DESCRIPTION
|
|
@@ -46,19 +46,15 @@ store all files as \fIsome/path/.../file.ext\fP and \fBborg create
|
|
|
/path/to/repo /home/user\fP will store all files as
|
|
|
\fIhome/user/.../file.ext\fP\&.
|
|
|
.sp
|
|
|
+A directory exclusion pattern can end either with or without a slash (\(aq/\(aq).
|
|
|
+If it ends with a slash, such as \fIsome/path/\fP, the directory will be
|
|
|
+included but not its content. If it does not end with a slash, such as
|
|
|
+\fIsome/path\fP, both the directory and content will be excluded.
|
|
|
+.sp
|
|
|
File patterns support these styles: fnmatch, shell, regular expressions,
|
|
|
path prefixes and path full\-matches. By default, fnmatch is used for
|
|
|
\fB\-\-exclude\fP patterns and shell\-style is used for the \fB\-\-pattern\fP
|
|
|
-.IP "System Message: ERROR/3 (docs/borg-patterns.rst:, line 43)"
|
|
|
-Unexpected indentation.
|
|
|
-.INDENT 0.0
|
|
|
-.INDENT 3.5
|
|
|
option. For commands that support patterns in their \fBPATH\fP argument
|
|
|
-.UNINDENT
|
|
|
-.UNINDENT
|
|
|
-.IP "System Message: WARNING/2 (docs/borg-patterns.rst:, line 44)"
|
|
|
-Block quote ends without a blank line; unexpected unindent.
|
|
|
-.sp
|
|
|
like (\fBborg list\fP), the default pattern is path prefix.
|
|
|
.sp
|
|
|
Starting with Borg 1.2, for all but regular expression pattern matching
|
|
@@ -187,69 +183,128 @@ sh:/home/*/.thumbnails
|
|
|
some file with spaces.txt
|
|
|
EOF
|
|
|
$ borg create \-\-exclude\-from exclude.txt backup /
|
|
|
-
|
|
|
+.ft P
|
|
|
+.fi
|
|
|
+.UNINDENT
|
|
|
+.UNINDENT
|
|
|
+.sp
|
|
|
A more general and easier to use way to define filename matching patterns exists
|
|
|
-with the \(ga\(ga\-\-pattern\(ga\(ga and \(ga\(ga\-\-patterns\-from\(ga\(ga options. Using these, you may
|
|
|
+with the \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 \(gaR\(ga, followed by a path (a plain path, not a
|
|
|
+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
|
|
|
with the prefix \-, an exclude\-norecurse rule starts with !, all followed by a pattern.
|
|
|
-
|
|
|
-\&.. note::
|
|
|
-
|
|
|
- Via \(ga\(ga\-\-pattern\(ga\(ga or \(ga\(ga\-\-patterns\-from\(ga\(ga you can define BOTH inclusion and exclusion
|
|
|
- of files using pattern prefixes \(ga\(ga+\(ga\(ga and \(ga\(ga\-\(ga\(ga. With \(ga\(ga\-\-exclude\(ga\(ga and
|
|
|
- \(ga\(ga\-\-exclude\-from\(ga\(ga ONLY excludes are defined.
|
|
|
-
|
|
|
+.sp
|
|
|
+\fBNOTE:\fP
|
|
|
+.INDENT 0.0
|
|
|
+.INDENT 3.5
|
|
|
+Via \fB\-\-pattern\fP or \fB\-\-patterns\-from\fP you can define BOTH inclusion and exclusion
|
|
|
+of files using pattern prefixes \fB+\fP and \fB\-\fP\&. With \fB\-\-exclude\fP and
|
|
|
+\fB\-\-exclude\-from\fP ONLY excludes are defined.
|
|
|
+.UNINDENT
|
|
|
+.UNINDENT
|
|
|
+.sp
|
|
|
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
|
|
|
an exclude pattern, the file is backed up. If an exclude\-norecurse pattern matches
|
|
|
a directory, it won\(aqt recurse into it and won\(aqt discover any potential matches for
|
|
|
include rules below that directory.
|
|
|
+.sp
|
|
|
+\fBNOTE:\fP
|
|
|
+.INDENT 0.0
|
|
|
+.INDENT 3.5
|
|
|
+It\(aqs possible that a sub\-directory/file is matched while parent directories are not.
|
|
|
+In that case, parent directories are not backed up thus their user, group, permission,
|
|
|
+etc. can not be restored.
|
|
|
+.UNINDENT
|
|
|
+.UNINDENT
|
|
|
+.sp
|
|
|
+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
|
|
|
+patterns. The pattern style can be set via the \fIP\fP prefix.
|
|
|
+.sp
|
|
|
+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
|
|
|
+Examples:
|
|
|
+.INDENT 0.0
|
|
|
+.INDENT 3.5
|
|
|
+.sp
|
|
|
+.nf
|
|
|
+.ft C
|
|
|
+# backup pics, but not the ones from 2018, except the good ones:
|
|
|
+# note: using = is essential to avoid cmdline argument parsing issues.
|
|
|
+borg create \-\-pattern=+pics/2018/good \-\-pattern=\-pics/2018 repo::arch pics
|
|
|
|
|
|
-\&.. note::
|
|
|
-
|
|
|
- It\(aqs possible that a sub\-directory/file is matched while parent directories are not.
|
|
|
- In that case, parent directories are not backed up thus their user, group, permission,
|
|
|
- etc. can not be restored.
|
|
|
-
|
|
|
-Note that the default pattern style for \(ga\(ga\-\-pattern\(ga\(ga and \(ga\(ga\-\-patterns\-from\(ga\(ga is
|
|
|
-shell style (\(gash:\(ga), so those patterns behave similar to rsync include/exclude
|
|
|
-patterns. The pattern style can be set via the \(gaP\(ga prefix.
|
|
|
-
|
|
|
-Patterns (\(ga\(ga\-\-pattern\(ga\(ga) and excludes (\(ga\(ga\-\-exclude\(ga\(ga) from the command line are
|
|
|
-considered first (in the order of appearance). Then patterns from \(ga\(ga\-\-patterns\-from\(ga\(ga
|
|
|
-are added. Exclusion patterns from \(ga\(ga\-\-exclude\-from\(ga\(ga files are appended last.
|
|
|
-
|
|
|
-Examples::
|
|
|
-
|
|
|
- # backup pics, but not the ones from 2018, except the good ones:
|
|
|
- # note: using = is essential to avoid cmdline argument parsing issues.
|
|
|
- borg create \-\-pattern=+pics/2018/good \-\-pattern=\-pics/2018 repo::arch pics
|
|
|
-
|
|
|
- # use a file with patterns:
|
|
|
- borg create \-\-patterns\-from patterns.lst repo::arch
|
|
|
-
|
|
|
-The patterns.lst file could look like that::
|
|
|
+# use a file with patterns:
|
|
|
+borg create \-\-patterns\-from patterns.lst repo::arch
|
|
|
+.ft P
|
|
|
+.fi
|
|
|
+.UNINDENT
|
|
|
+.UNINDENT
|
|
|
+.sp
|
|
|
+The patterns.lst file could look like that:
|
|
|
+.INDENT 0.0
|
|
|
+.INDENT 3.5
|
|
|
+.sp
|
|
|
+.nf
|
|
|
+.ft C
|
|
|
+# "sh:" pattern style is the default, so the following line is not needed:
|
|
|
+P sh
|
|
|
+R /
|
|
|
+# can be rebuild
|
|
|
+\- /home/*/.cache
|
|
|
+# they\(aqre downloads for a reason
|
|
|
+\- /home/*/Downloads
|
|
|
+# susan is a nice person
|
|
|
+# include susans home
|
|
|
++ /home/susan
|
|
|
+# also back up this exact file
|
|
|
++ pf:/home/bobby/specialfile.txt
|
|
|
+# don\(aqt backup the other home directories
|
|
|
+\- /home/*
|
|
|
+# don\(aqt even look in /proc
|
|
|
+! /proc
|
|
|
+.ft P
|
|
|
+.fi
|
|
|
+.UNINDENT
|
|
|
+.UNINDENT
|
|
|
+.sp
|
|
|
+You can specify recursion roots either on the command line or in a patternfile:
|
|
|
+.INDENT 0.0
|
|
|
+.INDENT 3.5
|
|
|
+.sp
|
|
|
+.nf
|
|
|
+.ft C
|
|
|
+# these two commands do the same thing
|
|
|
+borg create \-\-exclude /home/bobby/junk repo::arch /home/bobby /home/susan
|
|
|
+borg create \-\-patterns\-from patternfile.lst repo::arch
|
|
|
+.ft P
|
|
|
+.fi
|
|
|
+.UNINDENT
|
|
|
+.UNINDENT
|
|
|
+.sp
|
|
|
+The patternfile:
|
|
|
+.INDENT 0.0
|
|
|
+.INDENT 3.5
|
|
|
+.sp
|
|
|
+.nf
|
|
|
+.ft C
|
|
|
+# note that excludes use fm: by default and patternfiles use sh: by default.
|
|
|
+# therefore, we need to specify fm: to have the same exact behavior.
|
|
|
+P fm
|
|
|
+R /home/bobby
|
|
|
+R /home/susan
|
|
|
|
|
|
- # "sh:" pattern style is the default, so the following line is not needed:
|
|
|
- P sh
|
|
|
- R /
|
|
|
- # can be rebuild
|
|
|
- \- /home/*/.cache
|
|
|
- # they\(aqre downloads for a reason
|
|
|
- \- /home/*/Downloads
|
|
|
- # susan is a nice person
|
|
|
- # include susans home
|
|
|
- + /home/susan
|
|
|
- # don\(aqt backup the other home directories
|
|
|
- \- /home/*
|
|
|
- # don\(aqt even look in /proc
|
|
|
- ! /proc
|
|
|
+\- /home/bobby/junk
|
|
|
.ft P
|
|
|
.fi
|
|
|
.UNINDENT
|
|
|
.UNINDENT
|
|
|
+.sp
|
|
|
+This allows you to share the same patterns between multiple repositories
|
|
|
+without needing to specify them on the command line.
|
|
|
.SH AUTHOR
|
|
|
The Borg Collective
|
|
|
.\" Generated by docutils manpage writer.
|