BwFileStorage LFTP

From Lsdf

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 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 :~> open -u ka_xy1234 s
lftp> help


lftp -u ka_xy1234  s

Using lftp to mirror/transfer files

# <<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  s <<EOF
quit 0

Example 1:

lftp -e 'mirror -P 2 -Re ./testdir  ~/backupdir' -u 'ka_xy1234:password' s <<EOF
quit 0

Example 2:

lftp -e "mirror -ceR -I '*.tar' ./testdir ~/backupdir;quit" -u 'ka_xy1234:password' s