13

I am trying to do rsync between two directories I have in two filesystems connected to the same computer. I want to do it without deleting the extra files in b. I though a simple rsync -a a/dir b/dir would work, but it doesn't seem to. This is on a Linux system with rsync version 3.0.6 protocol version 30:

$ mkdir -p a/test
$ mkdir -p b/test
$ touch a/test/file1
$ touch a/test/file2
$ touch b/test/file3
$ tree a/test b/test
a/test
├── file1
└── file2
b/test
└── file3

0 directories, 3 files
$ rsync -a a/test/ b/
$ tree a/test b/test
a/test
├── file1
└── file2
b/test
└── file3

0 directories, 3 files

The same command does work when I use it on a different Linux system with a slightly newer version of rsync (rsync version 3.0.9 protocol version 30). Any ideas what am I missing?

  • looking at your posting "rsync -a a/test b/test" appears to do simply nothing at all, is that right? Is this a cut&paste error? I don't know the 'tree' cmd but at least both 'tree's show the same result. – sparkie Jan 31 '13 at 11:59
14

Answering my own question, it seems like the problem is with the slash at the end of the SRC dir:

rsync -a a/test/ b/

vs

rsync -a a/test  b/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.