Copying many sources to different places inside a destination

Wayne Davison wayned at samba.org
Tue Feb 28 07:18:39 GMT 2006


On Mon, Feb 27, 2006 at 06:33:44PM -0500, Matt McCutchen wrote:
> But the parts of the destination paths following ~/www are not always
> suffixes of the source paths, so --relative with dot-dirs is not good
> enough.

While rsync doesn't currently support this, but you might be able to
accomplish what you want by using some creative symlinks on the
destination side and --keep-dirlinks.  For instance:

mkdir /some/rsync-dest
cd /some/rsync-dest
ln -s ~/www main-web-content
ln -s ~/www/logicdes logicdes
ln -s ~/www/bigint-svn svn-repo
ln -s ~/www/math vectors
ln -s ~/www/mirror/bin mirror-latest

cd ~
rsync -avRK main-web-content logicdes bigint/./svn-repo \
           vectors/vectors.tex mirror/./mirror-latest /some/rsync-dest

With this arrangement you would need to be careful to either not use
--delete or to use some excludes to avoid having a problem with the
main-web-content interacting with the other content that is going into
the same dir.  E.g., you might need to specify options such as:

    --exclude=main-web-content/{logicdes,bigint-svn,math,mirror}

A similar symlink solution could be done on the source side using the
new --copy-dirlinks option, but only if the nesting of directories
allowed it to happen (which does not seem to be the case in your
example).

..wayne..


More information about the rsync mailing list