Scroll to navigation

ftpls(1) User Commands ftpls(1)


ftpls - generate a ftp directory listing.


ftpls [options] host[:port] [remotedir]

or: ftpls [options] URL


ftpls generates a listing of files and directories in a FTP directory. By default it prints a human readable ascii output, but may also create HTML and machine parsable output.


Connect / login / username / password options:

Use NAME to login on the ftp server.
The default is `anonymous'. Use an empty name to force the program to not log in.
Use PASS as password to login on the ftp server.
The default is `anonymous@invalid.example'. If an empty password is given the programm will not send a password to the server.
Send ACCOUNT as account name during login phase.
Note: this is _not_ the user name, but the name of what could be called a subaccount implemented by a few servers. If you don't understand what it means you have a good chance to never need this option anyway. If you think you need it please try the --user option first.
Number of tries to connect and log in.
The default is 1, meaning that the program will give up after the first error.
This option was added in version 0.3.0.
Number of tries to connect to data port.
The program will try to reach the data port (for retrieval of listings or data) that many times and will give up after that many errors in a row. The default is 5, meaning that the program will give up after the fifth error.
This option was added in version 0.6.6. The old behaviour was to give up after the first error.
Seconds to sleep after a failed login.
More precisely: the program will fall to sleep for this many seconds after a try to connect or login has failed. The default is 5. A 0 is treated as 1, and abuse, especially together with --tries, is likely to annory the servers adminstrators.
This option was added in version 0.4.5.
-4, --v4
Only use IPv4, even if v6 is available.
This option effectively disallows the use of IPv6, except for DNS queries.
It was added in version 0.6.0.
-6, --v6
Only use IPv6, even if v4 is available.
This option effectively disallows the use of IPv4, except for DNS queries.
It was added in version 0.6.0.

Operational options:

Read directories from stdin.
This option tells ftpls to ignore any directories given on the command line, and to read the directories to list from the standard input, reading one directory per line.ftpls will print an END-OF-COPY line after each operation. Do not use this option together with --html.
This option was added in version 0.3.6 and will be removed in future versions, unless someone objects.
Timeout to use for network read/write.
The default is 30 seconds and is usually sufficient.
This option was added in version 0.3.8.
Do recursive listing.
This option makes ftpls descend through the directory hierarchy and list all the directories and files it files. A top level directories content will be printed completely before the sub directories will be traversed.
Raw output in original format.
This will preserve the original format and sort order.
Descend at most LEVEL directories.

0 means `do not enter sub directories at all',
1 means `enter sub-directories, but not their sub-directories'.
The default is 2^32-1 meaning `enter all'.
This option enables the --recursive option.

Sorting options:

sort alphabetical.
sort reverse alphabetical.
sort youngest first.
sort oldest first.
sort shortest first.
sort longest first.

Output options:

OBSOLETE: Create HTML index.
This option is no longer supported.
Create machine parsable output.
Title text to use on the HTML output.
URL-Prefix to use in listings.
If this option is not given then an URL given on the command line will be used instead, and if this has not been given an URL will be created from host, port and directory given on the command line.
Print sub directory names.
This option makes ftpls print the name of a directory before it lists it's content. Note that the name of the top level directory of each listing will not be printed. This option is meant to be used together with --raw, and will not create useful output together with --html.

Workaround options:

Do directory listings in ASCII mode.
Use this option if the FTP server is unable to correctly list directories in binary mode, for example, if you see a message like this (usually on one line):
`fatal: received unwanted answer to LIST: 426 Data connection: Illegal seek.'
This option was added in version 0.5.2.
Add OPTS to LIST command.
This allows to pass arbitrary options to the FTP servers LIST command. Note that ftpcopy does not cope well with recursive directory listings.
This option was added in version 0.3.0.
Allow data connections to the address IP4.
Normally ftpls only accepts data connections to the IP addresses it received as an answer to the DNS request, or the IP address in the URL. Sometimes this is not enough, especially when NAT or masquerading are active. ftpcopy then prints an error message `illegal redirect by FTP server'. With this option, which may be given more than once, you can add additional addresses to the internal list of allowed data connection targets. IP4 has to be an IPv4 address or a list of IPv4 addresses, separated by commas.
The environment variable FTPCOPY_ALLOW_PASV_IP serves the same purpose.
Note: Do not use this option without thinking: FTP redirects may be used to launch denial of service attacks against innocent targets.
This option was added in version 0.6.1.
Use select, not poll.
Do not use the poll() system call even if it's available, but use select() instead. This allows the program to be used together with runsocks from the socks5 reference implementation.
Please note that you will need a directly reachable name server anyway, as the DNS library in use does not support SOCKS (you can always use IP addresses).
This option was added in version 0.3.8.

Help options:

Show usage examples.
Where to find related information.
Show version: ftpls (ftpcopy) 0.6.7.
Show a list of options or the long help on one.
The use with an argument shows the long help text
of that option, without an argument it will list
all options.
Show longer help texts for all or one option.


Generate a HTML index page:

ftpls \
--html --title 'CVS tree index by date' \
--urlprefix \
--newest \ \
> SOMEWHERE/cvs-trees/index-by-date.html


Copyright (C) 2003 Uwe Ohse.

The software comes with NO WARRANTY, to the extent permitted by law.

This package is published unter the terms of the GNU General Public License version 2. Later versions of the GPL may or may not apply, see


Uwe Ohse, <>.


Please report bugs to <>


ftpcopy(1) creates and maintains ftp mirrors.

The ftpcopy package has a mailing list. Send an empty mail to <> to subscribe to it.

The ftpcopy homepage is at