mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 09:47:58 +00:00
2bafece093
The existing option to exclude files and directories, “--exclude”, is implemented using fnmatch[1]. fnmatch matches the slash (“/”) with “*” and thus makes it impossible to write patterns where a directory with a given name should be excluded at a specific depth in the directory hierarchy, but not anywhere else. Consider this structure: home/ home/aaa home/aaa/.thumbnails home/user home/user/img home/user/img/.thumbnails fnmatch incorrectly excludes “home/user/img/.thumbnails” with a pattern of “home/*/.thumbnails” when the intention is to exclude “.thumbnails” in all home directories while retaining directories with the same name in all other locations. With this change regular expressions are introduced as an additional pattern syntax. The syntax is selected using a prefix on “--exclude”'s value. “re:” is for regular expression and “fm:”, the default, selects fnmatch. Selecting the syntax is necessary when regular expressions are desired or when the desired fnmatch pattern starts with two alphanumeric characters followed by a colon (i.e. “aa:something/*”). The exclusion described above can be implemented as follows: --exclude 're:^home/[^/]+/\.thumbnails$' The “--exclude-from” option permits loading exclusions from a text file where the same prefixes can now be used, e.g. “re:\.tmp$”. The documentation has been extended and now not only describes the two pattern styles, but also the file format supported by “--exclude-from”. This change has been discussed in issue #43 and in change request #497. [1] https://docs.python.org/3/library/fnmatch.html Signed-off-by: Michael Hanselmann <public@hansmi.ch> |
||
---|---|---|
.. | ||
_static | ||
borg_theme/css | ||
misc | ||
usage | ||
api.rst | ||
authors.rst | ||
changes.rst | ||
conf.py | ||
development.rst | ||
faq.rst | ||
global.rst.inc | ||
index.rst | ||
installation.rst | ||
internals.rst | ||
Makefile | ||
quickstart.rst | ||
resources.rst | ||
support.rst | ||
usage.rst |