TOOL » LINUX » PACKAGE

Lftp

Usage

It opens a shell-like interactive command line.

shell
lftp OPTIONS URL
OptionDescription
-uSpecify the user (and optionally a password, comma separated).
-pSpecify the port.
TargetURL syntax
FTP hostftp://host/path
SFTP hostsftp://host/path

After connecting to a remote server you have an interactive shell on the remote side. It may be a little confusing as the "local" may feel like where you are now (the remote), but that's not how it is.

  • local is your local PC
  • remote is the remote server.

Commands to navigate.

RemoteLocalDescription
cdlcdChange the current directory.
ls cls!lsList directory.

Connecting

Open

Open connection to a different remote than the one specified in the command line.

shell
open OPTS URL
OptionDescription
-uSpecify the user (and optionally a password, comma separated).
-pSpecify the port.

User

Use specified info for remote login. If password is not specified, it will ask.

shell
user USER PASS

Transferring files

Get

Retrieve the remote file. For wildcard expansion, use mget.

shell
get FILES
mget FILES
OptionDescription
-P --parallelDownload N files in parallel.

Put

Upload file into remote. For wildcard expansion, use mput.

shell
put FILES
mput FILES
OptionDescription
-P --parallelDownload N files in parallel.

Mirror

Mirror specified source directory to the target directory.

shell
mirror OPTIONS SOURCE TARGET

By default the source is remote and the target is a local directory (get). When using -R, the source directory is local and the target is remote (put).

OptionDescription
-R --reverseReverse mirror (put files).
-c --continueContinue a mirror job if possible.
-e --deleteDelete files not present at remote site.
-r --no-recursionDon't go to subdirectories.
-P --parallelDownload N files in parallel.
-i --includeInclude matching files (Regex).
-I --include-globInclude matching files (Glob).
-x --excludeExclude matching files (Regex).
-X --exclude-globExclude matching files (Glob).
--only-missingDownload only missing files.
--delete-excludedDelete files excluded at the target.
--include-glob-fromLoad include glob patterns from the file, one per line.
--exclude-glob-fromLoad exclude glob patterns from the file, one per line.

Examples

Download musics from www.vipvgm.net:

shell
mirror -erP 100 -I '*.m4a' --exclude-glob-from exclude.txt --only-missing --delete-excluded https://www.vipvgm.net/mu/

Sync files to Android through FTP or SFTP:

shell
mirror --reverse --parallel=10 --ignore-time --delete --no-perms --verbose ~/Music/ ftp://android/sd-card/Music
mirror --reverse --ignore-time --delete --no-perms --verbose ~/Music/ sftp://android/storage/AAAA-BBBB/Music