in/exclude[=] and multiple sources

Ken Gillett emailist at
Thu Aug 18 12:58:13 MDT 2011

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


More information about the rsync mailing list