trying to understand --include and --exclude

Wayne Davison wayned at samba.org
Sun Nov 27 21:54:37 GMT 2005


On Sun, Nov 27, 2005 at 11:10:39AM -0600, Phil Howard wrote:
>     --include '**/2005/07.tar.bz2' --exclude '**'

Taken from the manpage:

    Note that, when using the --recursive (-r) option (which is implied
    by -a), every subcomponent of every path is visited from the top
    down, so include/exclude patterns get applied recursively to each
    subcomponent's full name (e.g. to include "/foo/bar/baz" the
    subcomponents "/foo" and "/foo/bar" must not be excluded).  The
    exclude patterns actually short-circuit the directory traversal
    stage when rsync finds the files to send.  If a pattern excludes a
    particular parent directory, it can render a deeper include pattern
    ineffectual because rsync did not descend through that excluded
    section of the hierarchy.  This is particularly important when using
    a trailing '*' rule.

So, with your rules, nothing can ever match because all the base-level
dirs (and files) are excluded.

..wayne..


More information about the rsync mailing list