[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Welcome to ftpapi - TESTING



Sender: Scott Klement <klemscot@xxxxxxxxxxxx>


On Mon, 30 Sep 2002, Jim Langston wrote:
>
> I know that you have 2 options on FTP servers, either dir or ls, which
> give us 2 different types of lists.
>
> ls simply gives a list of files

That's not true.   Your FTP *client* has either "dir" or "ls". They send
the commands "LIST" and "NLST" respectively to the server.   I've used
clients that issue NLST for both commands, and I've used clients that
issue "LIST" for both commands.  But, the most common scenario is to
send "LIST" when you type "dir" and send "NLST" when you type "ls".

And some FTP clients (notably GUI ones) don't have "dir" or "ls" at all.

> dir gives quite a bit of information about files, library, size, date,
> time, type (*MEM or *FILE), but also gives full path names to files.

That's nice, but it's human-readable information.   Depending on the FTP
server, this listing will be COMPLETELY DIFFERENT, so you can't rely on
it to be in any specific format.

If you wanted to write program that was specific to a certain FTP server,
you could use the output of this command to determine the differences
between files & directories, but since it's not part of the standard, you
could not rely on it always being true.

> Does the FTPAPI have a dir command, or does it have something where the
> programmer can issue a command to the ftp server directly and parse the
> results him/herself?

Yes it has both.  FTP_dir() and FTP_list() provide the functions that you
think of as "dir" and "ls" respectively.   You can, of course, parse the
results yourself, if you like.

Also, the "dir" output is not guarenteed to be the same from release to
release, since it's intended to be human-readable.  (But then again, why
would they change it?)  So, even if you know the server you're connecting
to will always be an AS/400, you still should think long and hard before
doing things this way.



-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------