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
apt-get install lftp
zypper install lftp
yum install lftp
- lftp home: http://lftp.yar.ru/
- lftp man page: http://lftp.yar.ru/lftp-man.html
- lftp documentation wiki: http://linux.overshoot.tv/wiki/networking/lftp
lftp interactive shell
ou 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 ka_xy1234 sftp://bwfilestorage.lsdf.kit.edu Password: lftp firstname.lastname@example.org:~> help
lftp -u ka_xy1234 sftp://bwfilestorage.lsdf.kit.edu Password: lftp email@example.com:~>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://bwfilestorage.lsdf.kit.edu <<EOF quit 0 EOF
#!/bin/bash lftp -e 'mirror -P 2 -Re ./testdir ~/backupdir' -u 'ka_xy1234:password' sftp://bwfilestorage.lsdf.kit.edu <<EOF quit 0 EOF
#!/bin/bash lftp -e "mirror -ceR -I '*.tar' ./testdir ~/backupdir;quit" -u 'ka_xy1234:password' sftp://bwfilestorage.lsdf.kit.edu