I want to sync a directory between two systems. To make it more interesting the syncing must only be done in one direction, i.e.:
- if a file is deleted in the source directory, it must also be deleted in the destination, if it was previously transfered
- deleted files in the destination directory must not be deleted in the source
- partially transfered files (e.g. because of network problems) must be finished on the next sync
- new files in the source directory must be transfered to the destination
- deleted files in the destination directory must not be re-transfered
That means the source system has basically a master role, except that deleted files in the destination will not be forced back.
Both Linux systems have rsync/ssh/scp available.
New files in the source directory are created in such a way that one can use their mtime to detect them, e.g.:
if mtime(file) > date-of-last-sync then: it is a new file that needs to be transfered
Also, existing files are not changed in the source directory, i.e. the sync does not need to check for differences in already (completely) transfered files.
rsync
.rsync
would (by default) re-transfer files which were deleted from the destination directory.rsync
nor the full breadth of your requirements.