Feature request: Being able specify that the destination should follow source directory structure.

Wayne Davison wayned at samba.org
Fri Feb 25 23:49:17 GMT 2005


On Fri, Feb 25, 2005 at 06:13:53PM -0500, Hans Deragon wrote:
> Because I want to maintain the hard links, I do not want to run two
> separate rsync commands to perform this copying.

You might be able to use two separate runs and --link-dest to get what
you want:

COMMON=images/redhat/3.0WS/en/os/i386
SRC1=somedir/$COMMON
SRC2=someotherdir/1.0/$COMMON
DEST1=/export/distros/$COMMON
DEST2=/export/distros/1.0/$COMMON
rsync -avH --link-dest=$DEST2 one.server.com::distros/$SRC1/ $DEST1
rsync -avH --link-dest=$DEST1 one.server.com::distros/$SRC2/ $DEST2

This presumes that identical files are in identical dirs.  If not, you
can use -R combined with some symlinks and --no-implied-dirs to make the
original command work like you want:

cd /export
mkdir -p links/somedir links/someotherdir
mkdir -p distros/images distros/1.0
ln -s ../../distros/images links/somedir/images
ln -s ../../distros/1.0 links/someotherdir/1.0

rsync -avHR --no-implied-dirs
  one.server.com::"distros/somedir/images/redhat/3.0WS/en/os/i386
  distros/someotherdir/1.0/images/redhat/3.0WS/en/os/i386" /export/links

..wayne..


More information about the rsync mailing list