mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-02-07 05:31:01 -05:00
Make explicit that (in|ex)clude patterns are for relative
paths and that the leading / is the equivalent of ^ in regex.
This commit is contained in:
18
rsync.yo
18
rsync.yo
@@ -651,7 +651,7 @@ useful in combination with a recursive transfer.
|
||||
You may use as many --exclude options on the command line as you like
|
||||
to build up the list of files to exclude.
|
||||
|
||||
See the section on exclude patterns for information on the syntax of
|
||||
See the EXCLUDE PATTERNS section for information on the syntax of
|
||||
this option.
|
||||
|
||||
dit(bf(--exclude-from=FILE)) This option is similar to the --exclude
|
||||
@@ -664,7 +664,7 @@ dit(bf(--include=PATTERN)) This option tells rsync to not exclude the
|
||||
specified pattern of filenames. This is useful as it allows you to
|
||||
build up quite complex exclude/include rules.
|
||||
|
||||
See the section of exclude patterns for information on the syntax of
|
||||
See the EXCLUDE PATTERNS section for information on the syntax of
|
||||
this option.
|
||||
|
||||
dit(bf(--include-from=FILE)) This specifies a list of include patterns
|
||||
@@ -871,6 +871,12 @@ skipped. If it is an include pattern then that filename is not
|
||||
skipped. If no matching include/exclude pattern is found then the
|
||||
filename is not skipped.
|
||||
|
||||
The filenames matched against the exclude/incldue patterns are
|
||||
relative to the base directories so patterns should not
|
||||
include the path elements to those base directories. The
|
||||
only way in which a pattern will match the absolute path of
|
||||
a file or directory is if the base path is the root directory.
|
||||
|
||||
Note that when used with -r (which is implied by -a), every subcomponent of
|
||||
every path is visited from top down, so include/exclude patterns get
|
||||
applied recursively to each subcomponent.
|
||||
@@ -882,13 +888,17 @@ each. To add multiple patterns use the --include-from and
|
||||
The patterns can take several forms. The rules are:
|
||||
|
||||
itemize(
|
||||
|
||||
it() if the pattern starts with a / then it is matched against the
|
||||
start of the filename, otherwise it is matched against the end of
|
||||
the filename. Thus "/foo" would match a file called "foo" at the base of
|
||||
the tree. On the other hand, "foo" would match any file called "foo"
|
||||
the filename.
|
||||
This is the equivalent of a leading ^ in regular expressions.
|
||||
Thus "/foo" would match a file called "foo" at the base of the tree.
|
||||
On the other hand, "foo" would match any file called "foo"
|
||||
anywhere in the tree because the algorithm is applied recursively from
|
||||
top down; it behaves as if each path component gets a turn at being the
|
||||
end of the file name.
|
||||
The leading / does not make the pattern an absolute pathname.
|
||||
|
||||
it() if the pattern ends with a / then it will only match a
|
||||
directory, not a file, link or device.
|
||||
|
||||
Reference in New Issue
Block a user