Re: rsync



heavytull <heavytull@xxxxxxxxxxx> writes:

I'm trying to figure out how rsync works, because i need to synchronise a
ps'c HD with an external HD.

~$
~$mkdir src
~$mkdir dest
~$dd if=/dev/zero of=src/foo1 bs=1k count=1
~$rsync -t src dest
skipping directory src

I actually would like to synchronize the content of scr with that of dest

In figuring out how a program works, it really helps to read the
documentation.
The easiest way is
rsync -av src/ dest
(without the / you could copy the directory src, including the directory
into dest/ Ie you would have a directory dest/src/ . With the / it copies
the contents of src/ to dest/.


i also tried this:
~$rsync -t src/ dest
skipping directory src/.

Because you never told rsync what you wanted done with the contents of src/
-t is not a command to rsync to copy anything. -a is the most used such
directive, but read the man page for more information.



and this:

~$rsync -t src/ dest/
skipping directory src/.

this one finally worked
~$rsync -t src/* dest
foo1

sent 1108 bytes received 42 bytes 2300.00 bytes/sec
total size is 1024 speedup is 0.89

but i don't understand why the previous one (~$rsync -t src/ dest) didn't
work.

in the man page i don't understand the following:
"
A trailing slash on the source changes this behavior to avoid creating an
additional directory level at the destination. You can think of a
trailing / on a source as meaning "copy the contents of this directory" as
opposed to "copy the directory by name", but in both cases the attributes
of the containing directory are transferred to the containing
directory on the destination. In other words, each of the following
commands copies the files in the same way, including their setting of
the attributes of /dest/foo:

rsync -av /src/foo /dest
rsync -av /src/foo/ /dest/foo
"

At my understanding using a trailing slash would copy/synch the content of
foo while not using it would create or use if already done the directory /
dest/foo and then synch the content of foo with that of /dest/foo

No. src dst makes a copy of src inside dst, so you get dst/src/foo etc.

src/ copies the contents, so you get dst/foo
If you are going to copy directories you need at least the recursive flag
-r ( contained in -a)



.



Relevant Pages

  • rsync
    ... I'm trying to figure out how rsync works, because i need to synchronise a ... ~$rsync -t src dest ...
    (alt.os.linux)
  • Re: rsync
    ... ~$rsync -t src dest ... someone just learning rsync. ...
    (alt.os.linux)
  • Re: is strncpy useful at all?
    ... > You return a pointer to the terminating null byte of 'dest'. ... char* tstrncpy; ... void runTest(FP_STRNCPY fp, char* dest, char* src, size_t maxlen, ... runTest(tstrncpy, dest, src, sizeof src - 1, DEST_SIZE); ...
    (alt.comp.lang.learn.c-cpp)
  • Re: HLA History
    ... Well, I see that teaching people is in of itself, very dangerous. ... In C std libraries, everything is dest, src notation. ... My first programming language was actually TI-83 Calculator basic. ...
    (alt.lang.asm)
  • Very new student, Hanoi Towers
    ... public static void hanoiTower(int topN, char src, char inter, ... char dest) ... Disc 1 from A to C ...
    (comp.lang.java.help)

Loading