PROPHET/OS
NAME
rsync: copies a tree, but writes a file only if it is missing or differs
SYNOPSIS
rsync <source> <dest> | rsync <source> <host>:<name>
DESCRIPTION
Copies a tree, but writes a file only if it is missing or differs.
The comparison is on the contents, not on the timestamp. That is slower and it is the answer to the question actually being asked, which is whether the two files are the same.
rsync selbsttest
drives the decision whether a destination is remote
A destination on another machine
A colon makes the destination remote, and nothing else does: a path of this tree carries none. Before the colon stands the address, behind it the name the file gets over there.
rsync /root/NOTES.TXT 10.0.9.2:NOTES.TXT
The bytes go over copyv, which has to be serving on the other side (port 7421). Nothing about the comparison changes: rsync fetches the other side's file piece by piece and compares byte for byte, exactly as it does locally, and it writes only when something differs. So a second run over an unchanged file says 0 copied, 1 unchanged.
Remote takes **one file** and no tree: the other side stores under a bare name, so there are no folders over there a tree could fit into. A folder as the source is refused and says so.
EXAMPLE
$ rsync --help rsync <source> <dest> | rsync <source> <host>:<name> copies a tree, but writes a file only if it is missing or differs. A destination with a colon goes over copyv, and then it is one file and not a tree.