[patch] exclude patterns documentation
jw at pegasys.ws
Fri Jun 6 15:27:30 EST 2003
On Wed, Jun 04, 2003 at 02:59:59AM -0700, jw schultz wrote:
> I just reviewed the EXCLUDE PATTERNS section of the manpage
> and found that the declarative portion never actually states
> that only the part of the path that is relative destination
> is compared.
> I'm not quite satisfied with my text on this so if anyone
> has a better way of stating it i'm open to suggestions.
Oops, it was in the next paragraph. However, i'm reworking
this a bit. The manpage refers to the "base directory" but
never defines it and then proceeds to use that term as both
the source/destination directories and and later as the
highest level within those.
Here is another stab at it eliminating the term "base
directory". Instead i refer to the destination directory
because if you use -R the full path of the source will be
matched against. In the examples i change base to top. You
have to go underground to be below the base:)
If anyone has a better idea please speak up.
RCS file: /data/cvs/rsync/rsync.yo,v
retrieving revision 1.122
diff -u -r1.122 rsync.yo
--- rsync.yo 16 May 2003 04:23:34 -0000 1.122
+++ rsync.yo 6 Jun 2003 05:28:53 -0000
@@ -871,7 +871,7 @@
selection of which files to transfer and which files to skip.
rsync builds an ordered list of include/exclude options as specified on
-the command line. When a filename is encountered, rsync checks the
+the command line. Rsync checks each file and directory
name against each exclude/include pattern in turn. The first matching
pattern is acted on. If it is an exclude pattern, then that file is
skipped. If it is an include pattern then that filename is not
@@ -879,10 +879,11 @@
filename is not skipped.
The filenames matched against the exclude/include 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.
+relative to the destination directory, so patterns should not
+include the path elements of the source or destination
+The only way in which a pattern will match the absolute path of
+a file or directory is if the source 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
@@ -900,7 +901,7 @@
start of the filename, otherwise it is matched against the end of
This is the equivalent of a leading ^ in regular expressions.
- Thus "/foo" would match a file called "foo" at the base of the
+ Thus "/foo" would match a file called "foo" at the top of the
On the other hand, "foo" would match any file called "foo"
anywhere in the tree because the algorithm is applied recursively from
@@ -952,12 +953,12 @@
it() --exclude "*.o" would exclude all filenames matching *.o
- it() --exclude "/foo" would exclude a file in the base directory called foo
+ it() --exclude "/foo" would exclude a file called foo in the top directory
it() --exclude "foo/" would exclude any directory called foo
it() --exclude "/foo/*/bar" would exclude any file called bar two
- levels below a base directory called foo
+ levels below a directory called foo in the top directory
it() --exclude "/foo/**/bar" would exclude any file called bar two
- or more levels below a base directory called foo
+ or more levels below a directory called foo in the top directory
it() --include "*/" --include "*.c" --exclude "*" would include all
directories and C source files
it() --include "foo/" --include "foo/bar.c" --exclude "*" would include
J.W. Schultz Pegasystems Technologies
email address: jw at pegasys.ws
Remember Cernan and Schmitt
More information about the rsync