Rsync, two-way sync, and syncing file-deletion operations
I use rsync in the following manner:
rsync -Pvaz [email protected].*.***:Documents/ /Users/me/Documents/
rsync -Pvaz /Users/me/Documents/ [email protected].*.***:Documents/
The problem: if I delete a file on my home computer and sync, it doesn't get deleted on the remote computer. Is there a way to use rsync to literally sync two folders?
Solution 1:
Man page for rsync:
--delete delete extraneous files from dest dirs
--delete-before receiver deletes before transfer (default)
--delete-during receiver deletes during xfer, not before
--delete-delay find deletions during, delete after
--delete-after receiver deletes after transfer, not before
--delete-excluded also delete excluded files from dest dirs
Solution 2:
I am not a rsync expert and there may be a switch that can do what you want and someone else may say.
However, personally, I use rsync when I need one way copying. When it comes to synchronise two locations, I use Unison which is built on top of Rsync and basically makes it easier.