-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- --exclude=foo is equivalent to --exclude foo. The quotes are needed if
you need to protect something from shell escaping such as
- --exclude='*.foo' or --exclude 'foo bar'.
To supply multiple sources on the command line you simply supply more
than 1 path. The last path specified is the target. Each exclude
applies to the root of each source.
If you use both exclude and include then include is only used to
override an exclude that happens later in the command line (order matters).
If you find yourself making a complex set of excludes and includes then
I would suggest using --exclude-from=file and a file that looks
something like:
+ something you want
+ something else you want
- - stuff you don't want
- - more stuff you don't want
Using a file instead of the command line eliminates any need to protect
your input from the shell with quotes or escapes.
On 08/18/11 14:58, Ken Gillett wrote:> I have been using rsync on and off for years, but it still has the ability
to throw me on more occasions than I care to admit:-) Currently I am trying to
obtain a better understanding of the --include and --exclude options. Even
though I think I have a pretty good understanding of the basic mechanics of
these options and can usually get things to work as I want, there are a couple
of issues that still trouble me.
>
> First of all, the syntax. The man pages state quite clearly that this
should be --exclude=whatever and I still see this being given as advice from
obviously expert rsyncers. I have never got that to work and found that instead
--exclude 'whatever' worked. Could someone please enlighten me as to the
correctness or otherwise of these methods. Do they both work if used correctly?
If so, why is this not explained in the man pages along with how to use both
methods. If not, then why not and why is the man page apparently wrong?
>
> Then, I have a need to use multiple sources. Specifically, within a
directory on the (local) source machine I have a couple of directories I want to
sync to the (remote) destination, but not all of them as there's simply no
need to copy the others. Since the man pages indicate multiple sources can be
specified, it seems that I should be able to do this, but and here lies the rub,
what is then the 'transfer root' which rsync uses with the --include and
--exclude options. There may now be 2 entirely different sources with no common
elements to the path, so what is the 'transfer root' used in includes
and excludes?
>
> I can surmise that maybe the 'transfer root' effectively changes
depending on which source it is dealing with at any one time. IOW,
--exclude=/file1 would transfer NEITHER source1/file1 NOR source2/file1. Would
that be how it works?
>
> If not, I could really do with some advice about how it does work in this
situation.
>
>
>
> Ken G i l l e t t
>
> _/_/_/_/_/_/_/_/
>
>
>
>
- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
Kevin Korb Phone: (407) 252-6853
Systems Administrator Internet:
FutureQuest, Inc. Kevin at FutureQuest.net (work)
Orlando, Florida kmk at sanitarium.net (personal)
Web page: http://www.sanitarium.net/
PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk5NZH4ACgkQVKC1jlbQAQdWygCdH3j/SwSCdZWlivj1AQluAfuE
YCoAn1n3pWho6DT4mz0JFMbpmEb6FZG3
=d8Ds
-----END PGP SIGNATURE-----