Is rsync ~/foo target/foo the same as Is rsync ~/foo/ target/foo/?
Asked
Active
Viewed 161 times
1 Answers
4
No. The trailing slash on the source directory determines whether the directory and its contents or just its contents will be copied. And that's all that matters.
Given:
a/b
a/c
Then:
$ rsync a/ d/
$ ls d
b
c
But:
$ rsync a d/
$ ls d
a
The trailing slash on the destination, on the other hand, doesn't matter.
The fact that your example already has a directory in the destination with the same name as the source directory is not really important...target/foo
is always destination. In the examples above just replace a
with ~/foo
and d
with target/foo
and it works the same...
$ rsync ~/foo/ target/foo/
$ ls target/foo
b
c
...and...
$ rsync ~/foo target/foo
$ ls target/foo
foo

B Layer
- 5,171