Does a function exist similar to scp
where if the connection is lost, then the progress is saved, and resuming the process picks up where it left off? I am trying to scp
a large file, and my VPN connection keeps cutting out.
1 Answers
Use rsync --partial
. It will keep partially transferred files, which you can then resume with the same invocation. From the rsync man page:
--partial
By default, rsync will delete any partially transferred file if the transfer is interrupted. In some circumstances it is more desirable to keep partially transferred files. Using the --partial option tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster.
Try something like rsync -aivz --partial user@host:/path/to/file ~/destination/folder/
Explanation of the other switches:
a
— "archive mode": make transfer recursive; preserve symlinks, permissions, timestamps, group, owner; and (where possible) preserve special and device filesi
— "itemize changes": shows you what exactly is getting changed (it will be a string of all + signs if you're copying a file anew+++++++
)v
— "verbose": list files as they're transferredz
— "zip": compress data during transfer
Those are just the ones I usually use to transfer files. You can see a list of all options by looking at the rsync
man page.

- 1,865
- 12
- 33
-
What does the `-aivz` option do? – Adam_G Jul 11 '18 at 21:48
-
One additional question. I am doing this from AWS and usually use `scp -i
`. Can I do that with `rsync`? – Adam_G Jul 11 '18 at 21:52 -
(I updated my answer with an explanation of the other flags.) Apropos of using an identity file, it looks like someone asked a question about something similar: https://stackoverflow.com/questions/5527068/how-do-you-use-an-identity-file-with-rsync#5527157 I use ssh-add frequently. – Ashton Wiersdorf Jul 11 '18 at 21:59
-
Thank you for the clarification and additional reference – Adam_G Jul 11 '18 at 22:18