6

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?

asked May 26, 2013 at 8:12

Arne's user avatar

3

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

answered May 26, 2013 at 9:48

edelwater's user avatar

1

9

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.

answered Nov 28, 2017 at 12:58

Lenzoid's user avatar

1

7

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

answered Apr 29, 2018 at 19:41

Matteo Italia's user avatar

1

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.

answered May 26, 2013 at 8:19

Arne's user avatar

1

One liner with password-less ssh access looks as follows:

echo get -ar /file/path/file.data | sftp login@server

answered Jul 11, 2021 at 15:57

Anton K's user avatar

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.