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
1
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.
1
Current-day sftp supports the reget command to resume a download that was interrupted halfway.
1
You must log in to answer this question.
Explore related questions
See similar questions with these tags.