LSDF Online Storage: lftp
Using lftp from UNIX client
lftp is a command-line file transfer program (FTP client) for UNIX and Unix-like systems.
Besides FTP, it also supports HTTP, HTTPS and SFTP etc.
In addition to features common in advanced FTP clients, such as recursively mirroring entire directory trees and resuming downloads, lftp also supports more advanced functionality. Transfers can be scheduled for execution at a later time, bandwidth can be throttled, transfer queues can be created, and Unix shell-like job control is supported. The client can be used interactively or automated with scripts.
It also has an option called segmented file transfer that allows more than one connection for the same file, bypassing a maximum download speed per file when some servers establish a maximum speed per connection
Installation
Debian:
apt-get install lftp
Suse-Linux:
zypper install lftp
RedHat:
yum install lftp
Documentation
- lftp home: https://lftp.yar.ru/
- lftp man page: https://lftp.yar.ru/lftp-man.html
- lftp documentation wiki: http://linux.overshoot.tv/wiki/networking/lftp
lftp interactive shell
You can launch lftp by typing just lftp and then using an open command to take you to your target site or you can provide the target's name on the same line
lftp lftp :~> open -u xy1234 sftp://os-login.lsdf.kit.edu Password: lftp xy1234@os-login.lsdf.kit.edu:~> help
or
lftp -u xy1234 sftp://os-login.lsdf.kit.edu Password: lftp 1234@os-login.lsdf.kit.edu:~>help
Using lftp to mirror/transfer files
#!/bin/bash # <<EOF below is the functional equivalent of hitting .Enter. on your keyboard. # It allows the rest of the commands to be executed once connected # # mirror [OPTS] [source [target]] # mirror OPTS: # -c, --continue continue a mirror job if possible # -e, --delete delete files not present at remote site # -R, --reverse reverse mirror (put files) # -P, --parallel[=N] download N files in parallel # -v, --verbose[=level] verbose operation # -I GP, --include-glob GP include matching files # -r, --no-recursion donât go to subdirectories # .... lftp -e 'mirror -R /home/localuser/LocalDirToMirror ~/TargetDir' -u YourUsername,YourPassword sftp://os-login.lsdf.kit.edu <<EOF quit 0 EOF
Example 1:
#!/bin/bash lftp -e 'mirror -P 2 -Re ./testdir ~/backupdir' -u 'xy1234:password' sftp://os-login.lsdf.kit.edu <<EOF quit 0 EOF
Example 2:
#!/bin/bash lftp -e "mirror -ceR -I '*.tar' ./testdir ~/backupdir;quit" -u 'xy1234:password' sftp://os-login.lsdf.kit.edu