rsync-ing from two locations with same filenames (at different versions)

Mojca Miklavec mojca.miklavec.lists at gmail.com
Mon Nov 19 13:39:50 GMT 2007


Hello,

I would like to have a full repository, say, holding files
   full/a.txt (version 1)
   full/b.txt (version 1)
   full/c.txt (version 1)
and a repository of updates, for example
   new/b.txt (version 2 - newer)

Then, I would like to call
   rsync [flags] new/ full/ destination
to get
   destination/a.txt (v.1)
   destination/b.txt (v.2)
   destination/c.txt (v.1)

This simple case works OK and consistently.

However, the following case fails:

mkdir -p full/dir1
mkdir -p full/dir2
mkdir -p new/dir1
# also, is there a way to ask rsync to ignore this location if it doesn't exist?
mkdir -p new/dir2

echo "a" > full/dir1/a.txt
echo "b1" > full/dir1/b.txt
echo "c" > full/dir1/a.txt
echo "d" > full/dir2/a.txt
echo "b2" > new/dir1/b.txt

rsync -rpztlv --delete full/dir1/ full/dir2/ dest
rsync -rpztlv --delete new/dir1/ new/dir2/ full/dir1/ full/dir2/ dest

dest/b.txt now contains "b1", which is the wrong one. Is there a way
to force rsync to take b.txt from "new/dir1/b.txt" instead of taking
if from "full/dir1/b.txt"?

Thanks a lot,
     Mojca


More information about the rsync mailing list