It’s described in the rsync(1)
manpage:
A trailing slash on the source changes this behavior to avoid creating an additional directory level at the destination. You can think of a
trailing/
on a source as meaning “copy the contents of this directory” as opposed to “copy the directory by name”, but in both cases the
attributes of the containing directory are transferred to the containing directory on the destination. In other words, each of the following commands copies the files in the same way, including their setting of the attributes of/dest/foo
:rsync -av /src/foo /dest rsync -av /src/foo/ /dest/foo
As to the destination, I don’t think it has any major consequences. There is a difference if the source is a file and destination doesn’t exist — this will make a copy of SRC
called DEST
:
rsync SRC DEST
, whereas, this will create directory DEST
and copy the SRC
file into it:
rsync SRC DEST/