Can /usr/bin/sftp resume file transfers?

3

2

I have a machine with only sftp access. No ssh, no shell, no rsync. When I get a file using /usr/bin/sftp, can I make it resume an aborted transfer?

Arne

Posted 2013-05-26T08:12:02.773

Reputation: 649

Answers

2

I use lftp to auto sync all my photos from my NAS to my cheap webserver. If ever a photo changes it will automatically update it.

#!/bin/ash
SOURCE=/volume2/PHOTO/2011
BACKUPDIR=/foto.whatever.com/albums/2011

lftp -u username,password ftp.whatever.com << EOF
mirror -R -n -I *.jpg -I *.JPG -X @eaDir/ -X Collage/ -X ‘whatever/’ -X .piccache/ -X .recent/ -X Originals/ -X *.Db $SOURCE $BACKUPDIR
quit

edelwater

Posted 2013-05-26T08:12:02.773

Reputation: 619

Yup, a few minutes after I posted the question, I also found out about lftp, and I love it! – Arne – 2013-05-26T17:11:22.787

3

You can use the option -a in the get command in sftp to resume a previously aborted download.

Example:

echo -e "lcd ~/localFolder\nget -ar *" | sftp username@host.com:/some/path

Alternatively written as

sftp username@host.com:/some/path <<EOF
lcd ~/localFolder
get -ar *
EOF

However this does not automatically reconnect to the server should the connection be interrupted. lftp is the better alternative for this problem.

Lenzoid

Posted 2013-05-26T08:12:02.773

Reputation: 31

3

Current-day sftp supports the reget command to resume a download that was interrupted halfway.

Matteo Italia

Posted 2013-05-26T08:12:02.773

Reputation: 1 490

1

I just found the lftp program, and it supports get -c for resuming a download. If sftp can't do that, I think I'll stick with lftp.

Arne

Posted 2013-05-26T08:12:02.773

Reputation: 649