cURL / Mailing Lists / curl-users / Single Mail

curl-users

No subdirectories in ftp directory listings

From: Patrick Smith <patsmith_at_pobox.com>
Date: Mon, 06 May 2002 22:57:27 -0400

I just ran into something annoying... on ftp sites running wu-ftpd, the
--list-only option to curl does not include subdirectories in its output.

For example, here's the output of 'curl --list-only ftp://ftp.ibiblio.org/':

        IAFA-LISTINGS
        README
        ls-lR

Just plain 'curl ftp://ftp.ibiblio.org/' gives:

        total 77680
        -r--r--r-- 1 root other 79424359 May 6 06:07 IAFA-LISTINGS
        -rw-r--r-- 1 root root 1393 Feb 19 14:46 README
        dr-xr-xr-x 2 root other 4096 Mar 27 2001 bin
        dr-xr-xr-x 2 root other 4096 Jul 16 1997 dev
        dr-xr-xr-x 2 root other 4096 Mar 27 2001 etc
        drwxrwxrwx 19 ftp 20 4096 Apr 20 22:16 incoming
        drwxr-xr-x 2 root root 4096 Mar 27 2001 lib
        lrwxrwxrwx 1 root other 13 Mar 16 2001 ls-lR ->
IAFA-LISTINGS
        dr-xr-xr-x 18 root root 4096 May 1 05:56 pub
        dr-xr-xr-x 3 root other 4096 Jun 26 2000 unc
        dr-xr-xr-x 5 root other 4096 Jul 16 1997 usr

Here's a quote from http://www.wu-ftpd.org/wu-ftpd-faq.html explaining
the probable cause:

26. ls doesn't show anything except files. It does not show directories
and links

Some ftp clients improperly use the NLST and LIST commands. NLST was
intended to show files only for retrieval using the mget command. LIST
was intended to show everything in human-readable form. Earlier versions
of WU-FTPD did not correctly interpret the RFC which defines these
commands and many ftp clients were written incorrectly and do not use
the definitions in the RFC. Starting WU-FTPD 2.6.0, the interpretation
of NLST versus LIST ftp commands has been changed to what is the right
interpretation. NLST lists retrievable files for the ftp mget command,
LIST lists all files for a human reader. Suggested fix: fix the client
software, or train the users to use ls -l (or dir) in a command-line
client to get a listing of the files and directories.

So perhaps something should be done about this in curl, if only to note
this possibility in the man pages (with --list-only in curl(1) and
CURLOPT_FTPLISTONLY in curl_easy_setopt(3)).

-- 
patsmith_at_pobox.com
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: bandwidth_at_sourceforge.net
Received on 2002-05-07