rsync-ing from two locations with same filenames (at different
matt at mattmccutchen.net
Wed Jan 30 03:16:00 GMT 2008
On Mon, 2007-11-19 at 14:39 +0100, Mojca Miklavec wrote:
> 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?
Unfortunately not. I agree that this feature is useful, and I might
implement it at some point as a patch.
> 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"?
All that is going on here is that, if you run the sequence of commands
quickly, the files containing "b1" and "b2" pass the quick check with
each other because they have the same size and mtime. Thus, even though
the second rsync run does have the "b2" file in its file-list, it
incorrectly assumes the destination file (which contains "b1" from the
first run) does not need to be updated. To avoid this problem, use
--checksum or --ignore-times.
More information about the rsync