Stefan Langenmaier
10 months
Andreas Vöst
1 year
Florian Heinle
1 year

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 /.

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
Deleted user #4941
License
Source code in this card is licensed under the MIT License.