title: Two way sync with rsync
body: <p>I have a folder a/ and a remote folder A/.
  I now run something like this on a Makefile:</p>
  
  <pre><code>get-music:
   rsync -avzru server:/media/10001/music/ /media/Incoming/music/
  
  put-music:
   rsync -avzru /media/Incoming/music/ server:/media/10001/music/
  
  sync-music: get-music put-music
  </code></pre>
  
  <p>when I make sync-music, it first gets all the diffs from server to local and then the opposite, sending all the diffs from local to server.</p>
  
  <p>This works very well only if there are just updates or new files on the future. If there are deletions, it doesn't do anything.</p>
  
  <p>In rsync there is --delete and --delete-after options to help accomplish what I want but thing is, it doesn't work on a 2-way-sync.</p>
  
  <p>If I want to delete server files on a syn, when local files have been deleted, it works, but if, for some reason (explained after) I have some files that aren't in the server but exist locally and they were deleted, I want locally to remove them and not server copied (as it happens).</p>
  
  <p>Thing is I have 3 machines in context:</p>
  
  <ol>
  <li>desktop</li>
  <li>notebook</li>
  <li>home-server</li>
  </ol>
  
  <p>So, sometimes, server will have files that were deleted with a notebook sync, for example and then, when I run a sync with my desktop (where the deleted server files still exist on) I want these files to be deleted and not to be copied again to the server.</p>
  
  <p>I guess this is only possible with a database and track of operations :P</p>
  
  <p>Any simpler solutions?
  Thank you.</p>