Skip to content

Instantly share code, notes, and snippets.

@melodie11
Created April 24, 2026 00:26
Show Gist options
  • Select an option

  • Save melodie11/49010010be27d38754ff7a6fe8be0494 to your computer and use it in GitHub Desktop.

Select an option

Save melodie11/49010010be27d38754ff7a6fe8be0494 to your computer and use it in GitHub Desktop.
Man lftp - part 2
mget [-c] [-d] [-a] [-E] [-e] [-P N] [-O base] files
Gets selected files with expanded wildcards.
-c continue, reget.
-d create directories the same as file names and get the
files into them instead of current directory.
-E delete source files after successful transfer
-e delete target file before the transfer
-a use ascii mode (binary is the default)
-P N download N files in parallel
-O <base> specifies base directory or URL where files should be
placed
mirror [OPTS] [source [target]]
Mirror specified source directory to the target directory.
By default the source is remote and the target is a local directory.
When using -R, the source directory is local and the target is remote.
If the target directory is omitted, base name of the source directory is
used. If both directories are omitted, current local and remote directo‐
ries are used.
The source and/or the target may be URLs pointing to directories.
If the target directory ends with a slash (except the root directory)
then base name of the source directory is appended.
-c, --continue continue a mirror job if pos‐
sible
-e, --delete delete files not present at
the source
--delete-excluded delete files excluded at the
target
--delete-first delete old files before trans‐
ferring new ones
--depth-first descend into subdirectories
before transferring files
--scan-all-first scan all directories recur‐
sively before transferring
files
-s, --allow-suid set suid/sgid bits according
to the source
--allow-chown try to set owner and group on
files
--ascii use ascii mode transfers (im‐
plies --ignore-size)
--ignore-time ignore time when deciding
whether to download
--ignore-size ignore size when deciding
whether to download
--only-missing download only missing files
--only-existing download only files already
existing at target
-n, --only-newer download only newer files (-c
won't work)
--upload-older upload even files older than
the target ones
--transfer-all transfer all files, even seem‐
ingly the same at the target
site
--no-empty-dirs don't create empty directories
(implies --depth-first)
-r, --no-recursion don't go to subdirectories
--recursion=MODE go to subdirectories on a con‐
dition
--no-symlinks don't create symbolic links
-p, --no-perms don't set file permissions
--no-umask don't apply umask to file
modes
-R, --reverse reverse mirror (put files)
-L, --dereference download symbolic links as
files
--overwrite overwrite plain files without
removing them first
--no-overwrite remove and re-create plain
files instead of overwriting
-N, --newer-than=SPEC download only files newer than
specified time, or specified
local file modification time.
--older-than=SPEC download only files older than
specified time, or specified
local file modification time.
--size-range=RANGE download only files with size
in specified range
-P, --parallel[=N] download N files in parallel
--use-pget[-n=N] use pget to transfer every
single file
--on-change=CMD execute the command if any‐
thing has been changed
--loop repeat mirror until no changes
found
-i RX, --include=RX include matching files
-x RX, --exclude=RX exclude matching files
-I GP, --include-glob=GP include matching files
-X GP, --exclude-glob=GP exclude matching files
--include-rx-from=FILE
--exclude-rx-from=FILE
--include-glob-from=FILE
--exclude-glob-from=FILE load include/exclude patterns
from the file, one per line
-f FILE, --file=FILE mirror a single file or
globbed group (e.g.
/path/to/*.txt)
-F DIR, --directory=DIR mirror a single directory or
globbed group (e.g.
/path/to/dir*)
-O DIR, --target-directory=DIR target base path or URL
-v, --verbose[=level] verbose operation
--log=FILE write lftp commands being exe‐
cuted to FILE
--script=FILE write lftp commands to FILE,
but don't execute them
--just-print, --dry-run same as --script=-
--max-errors=N stop after this number of er‐
rors
--skip-noaccess don't try to transfer files
with no read access.
--use-cache use cached directory listings
--Remove-source-files remove source files after
transfer (use with caution)
--Remove-source-dirs remove source files and direc‐
tories after transfer (use
with caution). Top level di‐
rectory is not removed if it's
name ends with a slash.
--Move same as --Remove-source-dirs
-a same as --allow-chown --allow-
suid --no-umask
RX is an extended regular expression, just like in egrep(1).
GP is a glob pattern, e.g. `*.zip'.
Include and exclude options can be specified multiple times. It means
that a file or directory would be mirrored if it matches an include and
does not match to excludes after the include, or does not match anything
and the first check is exclude. Directories are matched with a slash ap‐
pended.
Note that symbolic links are not created when uploading to remote server,
because FTP protocol cannot do it. To upload files the links refer to,
use `mirror -RL' command (treat symbolic links as files).
For options --newer-than and --older-than you can either specify a local
file or time specification like that used by at(1) command, e.g.
`now-7days' or `week ago'. If you specify a file, then modification time
of that file will be used.
Verbosity level can be selected using --verbose=level option or by sev‐
eral -v options, e.g. -vvv. Levels are:
0 - no output (default)
1 - print actions
2 - +print not deleted file names (when -e is not specified)
3 - +print directory names which are mirrored
--only-newer turns off file size comparison and uploads/downloads only
newer files even if size is different. By default older files are trans‐
ferred and replace newer ones.
--upload-older allows replacing newer remote files with older ones (when
the target side is remote). Some remote back-ends cannot preserve time‐
stamps so the default is to keep newer files.
Recursion mode can be one of `always', `never', `missing', `newer'. With
the option `newer' mirror compares timestamps of directories and enters a
directory only if it is older or missing on the target side. Be aware
that when a file changes the directory timestamp may stay the same, so
mirror won't process that directory.
The options --file and --directory may be used multiple times and even
mixed provided that base directories of the paths are the same.
You can mirror between two servers if you specify URLs instead of direc‐
tories. FXP is automatically used for transfers between FTP servers, if
possible.
Some FTP servers hide dot-files by default (e.g. .htaccess), and show
them only when LIST command is used with -a option. In such case try to
use `set ftp:list-options -a'.
The recursion modes `newer' and `missing' conflict with --scan-all-first,
--depth-first, --no-empty-dirs and setting mirror:no-empty-dirs=true.
mkdir [-p] [-f] dir(s)
Make remote directories. If -p is used, make all components of paths.
The -f option makes mkdir quiet and suppresses messages.
module module [ args ]
Load given module using dlopen(3) function. If module name does not con‐
tain a slash, it is searched in directories specified by module:path
variable. Arguments are passed to module_init function. See README.mod‐
ules for technical details.
more files
Same as `cat files | more'. if PAGER is set, it is used as filter. (See
also cat, zcat and zmore)
mput [-c] [-d] [-a] [-E] [-e] [-P N] [-O base] files
Upload files with wildcard expansion. By default it uses the base name of
local name as remote one. This can be changed by `-d' option.
-c continue, reput
-d create directories the same as in file names and put
the files into them instead of current directory
-E delete source files after successful transfer (danger‐
ous)
-e delete target file before the transfer
-a use ascii mode (binary is the default)
-P N upload N files in parallel
-O <base> specifies base directory or URL where files should be
placed
mrm file(s)
Same as `glob rm'. Removes specified file(s) with wildcard expansion.
mmv [-O directory] file(s) directory
Move specified files to a target directory. The target directory can be
specified after -O option or as the last argument.
-O <dir> specifies the target directory where files should be
placed
mv file1 file2
Rename file1 to file2. No wildcard exmapsion is performed. If you give
more than two arguments, or the last argument ends with a slash, then mmv
command is executed instead.
nlist [args]
List remote file names
open [OPTS] site
Select a server by host name, URL or bookmark. When an URL or bookmark is
given, automatically change the current working directory to the direc‐
tory of the URL. Options:
-e cmd execute the command just after selecting the server
-u user[,pass] use the user/password for authentication. A colon can
also be used to separate user and password.
-p port use the port for connection
-s slot assign the connection to this slot
-d enable debug
-B don't look up bookmarks
--user user use the user for authentication
--password pass use the password for authentication
--env-password take password from LFTP_PASSWORD environment variable
site host name, URL or bookmark name
If the user name contains special characters (comma or colon) do not use
-u option, specify it with the --user option or quote it in the URL using
percent notation %AB.
pget [OPTS] rfile [-o lfile]
Gets the specified file using several connections. This can speed up
transfer, but loads the net and server heavily impacting other users. Use
only if you really have to transfer the file ASAP. Options:
-c continue transfer. Requires lfile.lftp-pget-status
file.
-n maxconn set maximum number of connections (default is taken
from pget:default-n setting)
put [-E] [-a] [-c] [-e] [-P N] [-O base] lfile [-o rfile]
Upload lfile with remote name rfile. If -o omitted, the base name of
lfile is used as remote name. Does not expand wildcards, use mput for
that.
-o <rfile> specifies remote file name (default - basename of
lfile)
-c continue, reput. It requires permission to overwrite
remote files
-E delete source files after successful transfer (dan‐
gerous)
-e delete target file before the transfer
-a use ascii mode (binary is the default)
-P N upload N files in parallel
-O <base> specifies base directory or URL where files should be
placed
pwd [-p]
Print current remote URL. Use `-p' option to show password in the URL.
queue [-n num ] cmd
Add the given command to queue for sequential execution. Each site has
its own queue. `-n' adds the command before the given item in the queue.
Don't try to queue `cd' or `lcd' commands, it may confuse lftp. Instead
do the cd/lcd before `queue' command, and it will remember the place in
which the command is to be done. It is possible to queue up an already
running job by `queue wait <jobno>', but the job will continue execution
even if it is not the first in queue.
`queue stop' will stop the queue, it will not execute any new commands,
but already running jobs will continue to run. You can use `queue stop'
to create an empty stopped queue. `queue start' will resume queue execu‐
tion. When you exit lftp, it will start all stopped queues automati‐
cally.
`queue' with no arguments will either create a stopped queue or print
queue status.
queue --delete|-d [index or wildcard expression]
Delete one or more items from the queue. If no argument is given, the
last entry in the queue is deleted.
queue --move|-m <index or wildcard expression> [index]
Move the given items before the given queue index, or to the end if no
destination is given.
-q Be quiet.
-v Be verbose.
-Q Output in a format that can be used to re-queue. Useful with
--delete.
Examples:
> get file &
[1] get file
> queue wait 1
> queue get another_file
> cd a_directory
> queue get yet_another_file
queue -d 3 Delete the third item in the queue.
queue -m 6 4 Move the sixth item in the queue before the
fourth.
queue -m "get*zip" 1 Move all commands matching "get*zip" to the
beginning of the queue. (The order of the
items is preserved.)
queue -d "get*zip" Delete all commands matching "get*zip".
quote cmd
For FTP - send the command uninterpreted. Use with caution - it can lead
to unknown remote state and thus will cause reconnect. You cannot be sure
that any change of remote state because of quoted command is solid - it
can be reset by reconnect at any time.
For HTTP - specific to HTTP action. Syntax: ``quote <command> [<args>]''.
Command may be ``set-cookie'' or ``post''.
open http://www.site.net
quote set-cookie "variable=value; othervar=othervalue"
set http:post-content-type application/x-www-form-urlencoded
quote post /cgi-bin/script.cgi "var=value&othervar=othervalue" > local_file
For FISH - send the command uninterpreted. This can be used to execute
arbitrary commands on server. The command must not take input or print
### at new line beginning. If it does, the protocol will become out of
sync.
open fish://server
quote find -name \*.zip
reget rfile [-o lfile]
Same as `get -c'.
rels [args]
Same as `ls', but ignores the cache.
renlist [args]
Same as `nlist', but ignores the cache.
repeat [OPTS] [[-d] delay] [command]
Repeat specified command with a delay between iterations. Default delay
is one second, default command is empty.
-c <count> maximum number of iterations
-d <delay> delay between iterations
--while-ok stop when command exits with non-zero code
--until-ok stop when command exits with zero code
--weak stop when lftp moves to background.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment