Rsync checks the contents of the file, not the date and/or file size. If the contents are different but with the same path and name, then the file will be overwritten.
The syntax for rsync is rsync options source destination
so if you want to keep a remote directory synced with a local one this should do the trick:
rsync -azh local_folder user@remote_server:/path/to/destination/
If you want to use SSH as a transfer protocol then this works for me:
rsync -azhe ssh local_folder user@remote_server:/path/to/destination
How are file permissions handled?
How are file modification dates handled?
The a
parameter preserves symlinks, file permissions, timestamps... if you dont want to transfer over this information just exclude it from the command, it will be owned by the user with whom you logged in the SSH session.
How does rsync react to failures and what is the exit code?
Most commands/programs return 0 when success and any other number on error. Here is a list of rsync exit codes for reference