cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Maybe I should RTFM...

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 8 Nov 2000 11:04:06 +0100 (MET)

On Wed, 8 Nov 2000, Janne Johansson wrote:

> But I tried the:
>
> curl -l ftp://my.s1cr1t.computer/pub/dir1
>
> and it listed pub/ even though dir1 is a directory.
>
> When I retried with:
>
> curl -l ftp://my.s1cr1t.computer/pub/dir1/
>
> it listed dir1 as I expected.
> Is it my "fault"?

Yes, its your fault. ;-)

Curl doesn't use any FTP commands to check for whether it is a directory or
file on the remote site. It assumes that what's given on the command line is
the truth. Thus, if it ends with a slash, its a directory, if it isn't, its a
file.

To know which directory it should operate on, it picks the path to the last
slash and changes dir to that one after login.

In this first case, you use -l which curl uses as an indicator that you're
dealing with a directory and thus it'll list the contents right away (instead
of getting the 'dir1' file). However, it'll only change to the /pub directory
and thus not do exactly what you'd expect.

If you run the same command lines without -l I think you better understand
what it does.

Of course it could be made to act differently, I just haven't felt any need.

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
Received on 2000-11-08