Uwe Ohse / available software / The ftpcopy package

## The ftpls program

ftpls - generate a ftp directory listing.

### SYNOPSIS

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

       or: ftpls [options] URL

### DESCRIPTION

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.

### OPTIONS

### Connect / login / username / password options:

-u, --user=NAME
  Use NAME to login on the ftp server. The default is `anonymous'. Use an empty name to force the program to not log in.
-p, --pass=PASSWORD
  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.
--account=ACCOUNT
  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.
--tries=ARG
  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.
--data-connect-retries=ARG
  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.
--login-sleep=ARG
  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:

--interactive
  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.
-T, --timeout=SECONDS
  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.
-R, --recursive
  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
  Raw output in original format. This will preserve the original format and sort order.
--max-depth=ARG
  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:

-a, --alpha
  sort alphabetical.
-z, --omega
  sort reverse alphabetical.
-n, --newest
  sort youngest first.
-o, --oldest
  sort oldest first.
-s, --shortest
  sort shortest first.
-l, --longest
  sort longest first.

  ### Output options:

-h, --html
  Create HTML index. The index will contain all files together with modification time and size. Note: The links in this index will contain username and password if you include them into an URL given to ftpls on the command line (either as argument or through the --urlprefix option). They will not be included otherwise, for security and privacy reasons.
-m, --machine
  Create machine parsable output.
-t, --title=TEXT
  Title text to use on the HTML output.
-U, --urlprefix=URL
  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-dir
  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:

--ascii-listings
  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.
-L, --list-options=OPTS
  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-pasv-ip=IP4
  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.
--force-select
  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:

--examples
  Show usage examples.
--see-also
  Where to find related information.
--version
  Show version: ftpls (ftpcopy) 0.6.7.
--help
  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.
--longhelp
  Show longer help texts for all or one option.

### EXAMPLES

Generate a HTML index page:

      ftpls \\
      --html --title 'CVS tree index by date' \\
      --urlprefix ftp://ftp.ohse.de/uwe/cvs-trees/  \\
      --newest \\
      ftp://serak.ohse.de/uwe/cvs-trees \\
      > SOMEWHERE/cvs-trees/index-by-date.html

### COPYRIGHT

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 http://www.ohse.de/uwe/licenses/

### AUTHOR

Uwe Ohse, uwe@ohse.de.

### MORE INFORMATION

Please report bugs to ftpcopy@lists.ohse.de

### SEE ALSO

ftpcopy(1) creates and maintains ftp mirrors.

The ftpcopy package has a mailing list. Send an empty mail to ftpcopy-subscribe@lists.ohse.de to subscribe to it.

The ftpcopy homepage is at

      http://www.ohse.de/uwe/ftpcopy.html