Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know rsync is a powerful tool.

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

assumption:

  • 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

target:

  • 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.

share|improve this question

migrated from serverfault.com Mar 4 '13 at 14:09

This question came from our site for system and network administrators.

    
man rsync clearly states all the options you need. – jwbensley Mar 4 '13 at 14:04
up vote 2 down vote accepted
$ rsync -az user@remote.host:/path/to/files /path/to/local/directory
share|improve this answer
    
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .