I know rsync is a powerful tool.

Can someone please tell me what settings I need to achive the following task.


  • the remote server is a linux box with ssh/rsync access
  • The original data lives on a remote server and should be transfered to a local computer
  • On the remote server, I have a directory with subdirectories and many small files to transfer
  • in the top directory, directories and files are created / changed / deleted


  • every day I start an rsync task to sync with the remote server
  • new files should be created locally
  • changed files should be synced
  • deleted files should be preserved
  • if I delete a file locally that still exists on the remote server it should be created again
  • if I modify a file locally that still exists on the remote server, it should be overwritten

so basically the remote server is the master and readonly.
I want to preserve a local copy of all files that live on the server.
But if a file is deleted on the server, I still want to keep the file as a local copy for archive purpose.

  • man rsync clearly states all the options you need.
    – jwbensley
    Mar 4 '13 at 14:04
$ rsync -az user@remote.host:/path/to/files /path/to/local/directory
  • A wisenheimer's comment will follow ;): With that command the folder files will created in /path/to/local/directory; if that is not wanted use ... user@remote.host:/path/to/files/ ... (note the trailing slash).
    – mpy
    Mar 4 '13 at 15:38
  • @mpy - yes, good point. I do typically use a trailing slash myself.
    – EEAA
    Mar 4 '13 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.