The rsync tool is a *nix command that can be used on macOS, Ubuntu (Debian) and CEntOS (RHEL) systems to “remote sync” two directories either on a local or remote computer system.
rsync -rvahP -e 'ssh -p 12345' /path/to/source username@servername.domain:/path/to/destination
A selection of common option flag descriptions:
-r, --recursive recurse into directories to include all subdirectories and files
-v, --verbose Increase verbosity
-a, --archive archive mode equals -rlptgoD (no -H,-A,-X)
-h, human-readable human-readable number formatting
Other Useful Commands:
-b, --backup take the backup during synchronization
-e, -–rsh=COMMAND indicate the remote shell to use in rsync
-g, --group preserve group
-l, --links copy symlinks as symlinks during the sync
-n, --dry-run perform trial run without synchronization
-p, --perms preserve permissions
-o, --owner preserve owner (super-user only)
-q, --quiet suppress message output
-t, --times preserve times
-u, --update don’t copy the files if destination files are newer
-z, --compress compress file data during the transfer
-P, --progress show progress of the sync during transfer
Further reading may be found here: