开发者

Format of the data returned by the FTP LIST command?

I'm in the mid开发者_开发问答dle of writing an FTP server but I'm a little confused about what format to send the file list in.

Using 2 terminals and an FTP client, I was able to run through a simple FTP exchange. However, I wasn't really sure what format to send the file lists in.

Is there some accepted format? What columns should I use?


This is what the RFC has to say:

The data transfer is over the data connection in type ASCII or type EBCDIC. (The user must ensure that the TYPE is appropriately ASCII or EBCDIC). Since the information on a file may vary widely from system to system, this information may be hard to use automatically in a program, but may be quite useful to a human user.

So, the result is not expected to be automatically parsed.


The standard doesn't define format of the directory listing sent/received using LIST command. Most servers use Unix listing format (don't know if it's defined in any document, but it's rather simple to generate and parse), some use DOS/Windows format. Other formats (over 400 as far as I know) are used worldwide, but the Unix one has become a standard de-facto.

Now there's important thing to implement: MLST and LMSD extension commands, defined in RFC 3659. They define a way to produce and obtain machine-readable listing, which is very welcome in any modern FTP server.


The RFC is poor there, but there are some nice links:

https://files.stairways.com/other/ftp-list-specs-info.txt

http://cr.yp.to/ftp/list/binls.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜