Feature req: multiple source trees

Dave Dykstra dwd at bell-labs.com
Fri Oct 26 01:34:27 EST 2001

On Thu, Oct 25, 2001 at 07:07:26AM +0200, Ph. Marek wrote [in private email]:
> >How is that different from the behavior now when multiple source 
> >directories are given?  The rsync Usage says:
> >
> >    Usage: rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST
> >      or   rsync [OPTION]... [USER@]HOST:SRC DEST
> >      or   rsync [OPTION]... SRC [SRC]... DEST
> >      or   rsync [OPTION]... [USER@]HOST::SRC [DEST]
> >      or   rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST
> >      or   rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]
> >    SRC on single-colon remote HOST will be expanded by remote shell
> >    SRC on server remote HOST may contain shell wildcards or multiple
> >      sources separated by space as long as they have same top-level
> >
> >Multiple sources can be specified in all cases.
> but these sources are independent, right?
> if I "rsync A B C host:/target" I get host:/target/A, host:/target/B and
> host:/target/C. 
> I'd like to get (given the data A/a, A/b, B/b, B/c and C/d)
> host:/target/a, host:/target/b (from directory B as it "overrides" A),
> host:/target/c and host:/target/d.
> I know that this can be done using 3 rsync-statements (one for A, B and C),
> but I think this is horrible inefficient as Files which are in B or C but
> not in A get deleted everytime and recreated.
> Is that better explained??

If you add a slash to the end of each source path, they will get merged
into the target:

    rsync -a A/ B/ C/ host:/target

Rsync always adds the base directory component of the source path to the
destination path if you don't end the source path in a slash.

- Dave Dykstra

More information about the rsync mailing list