rsync
— односторонняя -операция.Вы можете попытаться реализовать двухстороннюю -репликацию с его помощью, но он ненадежен и подвержен ошибкам. Однако вы можете предотвратить удаление rsync
более нового файла в месте назначения с помощью переключателя --update
:
-u, --update
This forces rsync to skip any files which exist on the destination and have a modified time that is newer than the source file. (If an
existing destination file has a modify time equal to the source file's, it will be updated if the sizes are different.)
In the current implementation of --update, a difference of file format between the sender and receiver is always considered to be important
enough for an update, no matter what date is on the objects. In other words, if the source has a directory or a symlink where the destina-
tion has a file, the transfer would occur regardless of the timestamps.