1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 09:47:58 +00:00
borg/docs
Michael Hanselmann 2bafece093 Implement exclusions using regular expressions
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>
2016-01-13 17:39:19 +01:00
..
_static ran build_api and build_usage 2015-12-13 15:47:03 +01:00
borg_theme/css rtd theme adjustment: borg darkness for the upper left corner 2015-11-20 18:51:11 +01:00
misc borgbackup install+basics presentation(asciinema + script) 2015-10-24 23:40:51 +02:00
usage ran build_api and build_usage 2015-12-13 15:47:03 +01:00
api.rst ran build_api and build_usage 2015-12-13 15:47:03 +01:00
authors.rst
changes.rst update CHANGES 2015-12-13 15:41:18 +01:00
conf.py it's 2016 2016-01-13 00:42:23 +01:00
development.rst minor development docs fixes 2016-01-12 23:49:19 +01:00
faq.rst Update FAQ 2016-01-09 23:50:41 +01:00
global.rst.inc docs: replace "|project_name|" with just "Borg", less ugly 2016-01-13 00:25:43 +01:00
index.rst docs: add resources section, with videos, talks, presentations 2015-12-03 16:58:48 +01:00
installation.rst Documentation: Standalone binary / pyinstaller extracts dependencies into /tmp. Currently /tmp requires about ~28MB of free space. It also needs exec permissions. 2016-01-06 13:35:28 +01:00
internals.rst updated internals docs: hash table max. load factor is 0.75 now 2015-12-13 19:58:32 +01:00
Makefile
quickstart.rst mention --save-space at the place we talk about keeping disk space free 2015-12-08 18:36:41 +01:00
resources.rst docs: move related projects to resources section 2015-12-03 17:13:39 +01:00
support.rst rephrase the mailing list section 2015-12-13 15:59:33 -05:00
usage.rst Implement exclusions using regular expressions 2016-01-13 17:39:19 +01:00