Can /usr/bin/sftp resume file transfers?

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

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 [email protected]:/some/path

Alternatively written as

sftp [email protected]:/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.


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


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.