RSync has some different and confusing behavior depending on whether you put a trailing slash on the source directory or not.
- No trailing slash on source directory: this copies the source directory itself as a subdirectory into the destination directory.
$ rsync -a /some/path/foobar . $ ls foobar/
- Trailing slash on source directory: this copies the contents inside source directory into the destination directory.
$ rsync -a /some/path/foobar/ . $ ls content.txt of.txt foobar.txt
You do not see such confusing behavior with cp or mv. I guess rsync has this because it is usually used for synchronizing the contents of two directories but it is also sometimes used to copy over directories.