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 was transferring several thousand files each ~1MB via scp and my connection was broken after the first 2k files or so. I wanted to know if there was a way to resume the recursive transfer w/o starting over. Something like

$ scp -r ./
... Happy Transfer ...
...     BREAK!     ...
$ rsync -P ./
... Continue transf...

The problem is I can't seem to get the syntax correct if it is possible. Can anyone shed some light on if/how it can be done?

PS. If you specify the slash after "datafiles" in the rsync line, does that transfer the directory or its contents? I saw conflicting comments when I googled.

share|improve this question

migrated from Jun 2 '11 at 0:31

This question came from our site for professional and enthusiast programmers.

up vote 9 down vote accepted

if you are rsyncing from a local machine to a remote host, this would work:

rsync -avzl -e ssh /directory/with/files/
share|improve this answer
Thanks. I didn't think this was working because it would begin listing all my files but I didn't realize that it was showing the "file transfer" which just mean noticing the file was up to date. Right were my transfer left off it picked up with real (slower) transfers. – physicsmichael Jun 1 '10 at 16:23
Hmm, for me ssh -i akey.pem is required and I can't get the -i part to work with these commands. – isomorphismes Sep 24 '12 at 3:26
If you are trying to resume a large file, this options may be useful: --partial --inplace --no-whole-file. – Rafael Xavier Mar 11 '13 at 18:59
@kibitzer - once it showed you the file (on remote server), how did you start the transfer again? Mine just build the list file and shows me the file and how much was uploaded. But it just hangs with no option to continue or progress output. Has the transfer started again or do I need to do something to start it? – masterninja01 Mar 23 '14 at 23:11
-l is not necessary. It's implied by -a – Guido May 17 '14 at 15:27

The following line should do the trick for that:

rsync --partial --progress --rsh=ssh -r ./

I've never used this for recursive directories before, but when I texted it just now it seemed to work as expected.

share|improve this answer
This works too, as long as you include the -r =) – physicsmichael Jun 1 '10 at 17:07
Most of my rsync transfers are of the type "rsync -ahP something/ user@host:/somewhere/". The --rsh=ssh is completely unnecessary. Then, also -P drags in --partial and --progress. – killermist Jun 5 '13 at 1:56

The rsync command you listed would work, if you only added "-r". but you would also most likely want "-a" and "-v".

And about the trailing slash, is equivalent to /data/*, in other words, if you add a slash, it copies all the contents. but would be the directory itself [and naturally, its subfolders]

share|improve this answer

Merging kibitzer's and Tyler's answers worked best for me:

rsync --partial --progress -avzl -e ssh /directory/with/files/

(rsyncing recursively and showing progress of each file)

share|improve this answer

You must log in to answer this question.

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