rsync between two local directories

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?

1

1 Answer

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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like