D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] howto sync two files



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kai Hendry wrote:
| I want to sync two files. I.e. if they are different, they are
merged
| together.
|
| I thought rsync was the tool for the job, but after playing
with it
| tonight, it just seems to do the same as cp! Or have I got it
all wrong?

Nah it does the same as rcp, nothing like cp at all ;-)

rsync makes the target the same as the original, with certain
rules, one of which is don't update the target if it is newer

So you might want

rsync -u test1 test2
rsync -u test2 test1

Which says if test1 is newer keep it, else if test2 is newer
we'll have that. Conflict resolution (what to do if they both
changed at the same time?) is implicit in the order the syncs
are called.

Look at the rsync manual page, now do you see why he has
makefile with "get" and "put" as targets? He may well run both!

For local files this is overkill, try "cp -u" ;-)

Rsync scores when you have large files where bits of one had
changed, or elsewhere when it's algorithmns on comparison beat a
straight copy. Such as some mailbox formats which append new
messages.

Thus I use "rsync -az / backup:/linux1 -e /usr/local/bin/ssh" as
a quick and dirty backup of a whole disk, if yesterdays backup
is there it need only send changes across - note not a
differential backup which typically copies a whole file even if
only one byte changed! Note also the ease it sends it encrypted
(handy for wireless LAN's).

Your approach to syncronisation looks very crude - what are you
synchronising and why?

I guess rsync is a misnomer, think "better-rcp"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+FjGFGFXfHI9FVgYRAgC4AKCxXz8wP+Eta/e+cY35GzPaUQr79wCeKZwq
Cj6LW8p/nKAMVz1eXEq4r3g=
=W3/o
-----END PGP SIGNATURE-----

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly