I would like to use rsync to copy files from a remote server. I would like to

  • only copy files from server, not push any back out.
  • copy files that dont exit. If the remote file is newer i DO NOT want to copy it
  • have it automatic. This prompts me for my password everytime and i would like it to be ran by cron. So how do i run it in a bash script executed by cron?
link|improve this question

50% accept rate
feedback

2 Answers

up vote 2 down vote accepted

Points 1 and 2: How to specify what to copy is best answered by reading the rsync manpage.

Point 3: This tutorial should get you going using passwordless ssh with rsync. Summary: set up passwordless ssh and use '-e ssh' to tell rsync to use ssh instead of rsh to connect to the remote host.

link|improve this answer
I looked at the man and i cant figure out what will allow me to copy new files only and not update. – acidzombie24 Jul 13 '10 at 20:21
feedback

For the second part, since pjz answered the rest, I believe you can use the --ignore-existing switch to only get new files.

From http://www.samba.org/ftp/rsync/rsync.html:

This tells rsync to skip updating files that already exist on the destination (this does not ignore existing directories, or nothing would get done). See also --existing. This option is a transfer rule, not an exclude, so it doesn't affect the data that goes into the file-lists, and thus it doesn't affect deletions. It just limits the files that the receiver requests to be transferred.

This option can be useful for those doing backups using the --link-dest option when they need to continue a backup run that got interrupted. Since a --link-dest run is copied into a new directory hierarchy (when it is used properly), using --ignore existing will ensure that the already-handled files don't get tweaked (which avoids a change in permissions on the hard-linked files). This does mean that this option is only looking at the existing files in the destination hierarchy itself.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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