From d780ec4bcebbc66eeb60c2b602889108c5297c96 Mon Sep 17 00:00:00 2001 From: Andreas Metzler Date: Sun, 24 Dec 2017 15:39:18 +0100 Subject: [PATCH] doc: Improvements for --exclude Describe exclude pattern handling, adding multiple examples. Closes #396 --- doc/040_backup.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/040_backup.rst b/doc/040_backup.rst index 034923cf1..c5f6de0de 100644 --- a/doc/040_backup.rst +++ b/doc/040_backup.rst @@ -89,7 +89,16 @@ specify them with multiple ``--exclude``'s or one ``--exclude-file`` Patterns use `filepath.Glob `__ internally, see `filepath.Match `__ for syntax. -Additionally ``**`` excludes arbitrary subdirectories. +Patterns are tested against the full path of a file/dir to be saved, not only +against the relative path below the argument given to restic backup. +Patterns need to match on complete path components. (``foo`` matches +``/dir1/foo/dir2/file`` and ``/dir/foo`` but does not match ``/dir/foobar`` or +``barfoo``.) A trailing ``/`` is ignored. A leading ``/`` anchors the +pattern at the root directory. (``/bin`` matches ``/bin/bash`` but does not +match ``/usr/bin/restic``.) Regular wildcards cannot be used to match over the +directory separator ``/``. (``b*ash`` matches ``/bin/bash`` but does not match +``/bin/ash``.) However ``**`` matches arbitrary subdirectories. (``foo/**/bar`` +matches ``/dir1/foo/dir2/bar/file``, ``/foo/bar/file`` and ``/tmp/foo/bar``.) Environment-variables in exclude-files are expanded with `os.ExpandEnv `__.