Change destination root?

Matt McCutchen matt at mattmccutchen.net
Mon Dec 17 05:48:04 GMT 2007


On Sun, 2007-12-16 at 11:40 -0800, Max Kipness wrote:
> host1.domain.com 
> Source Directory: /data
> 
> -files-from file
> 
> c/contents
> c/contents
> 
> I want this to end up on host2.domain.com as
> 
> /backup/x/contents
> /backup/x/contents
> 
> So it's not the root thats the problem but the next level down. I need to be
> able to list the paths to be backed up via -files-from, but yet need c to
> end up as x on the destination.

If all the paths in the --files-from file begin with c/ , the easiest
thing to do is remove the prefix and use /data/c/ as the source
and /backup/x/ as the destination.  If there are also paths that do not
begin with c/ , you could split the rsync run in two, one for c/ -> x/
and one for everything else.

Alternatively, you could make a symlink from x to c in the source and
express the paths in terms of x instead of c.  (If you don't want to
modify the source, you could put the symlink elsewhere and use ./ to get
the right file-list paths.)  Or, you could make a symlink from c to x in
the destination and pass --keep-dirlinks (but that may have undesired
consequences elsewhere).

Alternatively, rsync could be enhanced with a --transform option like
GNU tar has to perform regular-expression replacements on the file-list
paths.  I assume that --transform would take effect at one of the times
that --iconv does and use the same unsorted file-list support.  I think
this addition would make rsync considerably more powerful.

Matt



More information about the rsync mailing list