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 me@host.com:/datafiles/ ./
... Happy Transfer ...
...     BREAK!     ...
$ rsync -P me@host.com:/datafiles/ ./
... 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.

link|improve this question

feedback

migrated from stackoverflow.com Jun 2 '11 at 0:31

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

3 Answers

up vote 3 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/ you@host.com:/new/directory/
link|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. – vgm64 Jun 1 '10 at 16:23
feedback

The following line should do the trick for that:

rsync --partial --progress --rsh=ssh -r me@host.com:/datafiles/ ./

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

link|improve this answer
This works too, as long as you include the -r =) – vgm64 Jun 1 '10 at 17:07
feedback

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, me@site.com:/data/ is equivalent to /data/*, in other words, if you add a slash, it copies all the contents. but me@site.com:/data would be the directory itself [and naturally, its subfolders]

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.