exclude-from and include-from confusion

Wayne Davison wayned at samba.org
Wed Apr 21 21:20:55 GMT 2004

On Wed, Apr 21, 2004 at 04:51:57PM -0400, Dave.Turner at VerizonWireless.com wrote:
> - Any directory or file listed in the exclude file will NOT be copied.
> - Any directory of file listed in the include file WILL be copied no matter
> what is in the exclude file.

Only if the include comes before the exclude in the list of all includes
and excludes.  If you reverse the order of your --exclude-from and
--include-from options that would give the includes priority over the
excludes.  However, I'd recommend joining both files into a single file
using explicit "+ " and "- " prefixes and switching over to just one
--exclude-from=combo_file option.  E.g.:

+ /testdir/
+ /testdir/*
- *

(Note the explicit inclusion of the parent directory -- see the man
page's discssion of how patterns are applied recursively.)

Another solution that would work for the simple set of rules you listed
is this:

+ /testdir/
- /*

The two methods differ in how they treat subdirectories in "testdir",


More information about the rsync mailing list