Rsync copy directory contents but not directory itself

rsync interprets a directory with no trailing slash as copy this directory, and a directory with a trailing slash as copy the contents of this directory.

Try rsync -av ~/foo/ [email protected]:/var/www/bar/


It's simple,

rsync /var/www/ /home/var - copies the contents of /var/www/ but not the www folder itself.

rsync /var/www /home/var - copies the folder www along with all its contents.

The "/" makes the difference.