Andreas Vöst
1 month
Marc Dierig
3 months
Claus-Theodor Riegg
7 years
Claus-Theodor Riegg
6 years
Claus-Theodor Riegg
4 years
Andreas Vöst
8 months

Pay attention to trailing slashes when using rsync

Posted Almost 3 years ago. Visible to the public. Repeats.

When you synchronize directories with rsync you have to pay attention to use (or not use) trailing /.

Example:

# without trailing slash
$ mkdir -p a/foo/bar/baz
$ mkdir b
$ rsync -a a b
$ find b
b
b/a
b/a/foo
b/a/foo/bar
b/a/foo/bar/baz

# with trailing slash
$ mkdir -p a/foo/bar/baz
$ mkdir b
$ rsync -a a/ b/
$ find b
b
b/foo
b/foo/bar
b/foo/bar/baz
Last edit
Almost 2 years ago
Deleted user #4941
License
Source code in this card is licensed under the MIT License.