Ubuntu – How to synchronize a local folder with a remote


I want to upload a batch of files to my server periodically preserving the originals only in the server, that is:

  • If I delete the local folder, files are not ereased from the server.
  • If local files are replaced, they are added to remote.
  • It should restore the transfer if the connection is lost during the process.
  • Bonus points if it works in Windows

I thought that rsync and a cron job should do the trick but I happen to have no idea about how to use those (well, ok… I have ONE idea about how to use cron).

Best Answer

I'd recommend Unison, which can sync between unix and windows. It's built on top of the same technology as rsync, but it is a lot easier to set up:



It supports exclude/include lists, remote or local syncs, no-delete mode, and lots of other common options. It can recover from a partial sync due to bad connection or anything else quite easily.

You can run it interactively or as a batch process using cron.

Related Question