Andreas Vöst
26 days
Claus-Theodor Riegg
4 years
Andreas Vöst
2 months
Andreas Vöst
2 months
Kim Klotz
3 months
Claus-Theodor Riegg
8 years
Andreas Vöst
5 months
Andreas Vöst
7 months
Claus-Theodor Riegg
8 years
Marc Dierig
9 months
Claus-Theodor Riegg
7 years

Pay attention to trailing slashes when using rsync

Updated . Posted . Visible to the public. Repeats.

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

Hint

Use rsync -nv to check everything with a dry-run first.

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
Andreas Vöst
License
Source code in this card is licensed under the MIT License.