10

I'm in the middle 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?

9
  • 1
    I don't believe this is anything resembling a standard. Different servers give different outputs, they're supposed to be human-readable rather than machine-readable.
    – skaffman
    Commented Dec 30, 2010 at 17:09
  • @skaffman nice comment, but this should be an answer, not a comment, so that others can vote for it. Commented Dec 30, 2010 at 17:11
  • @skaff: Then how are graphical FTP clients supposed to interpret them? Commented Dec 30, 2010 at 17:11
  • 1
    @George They try to guess the output format and parse it. Some clients recognize hundreds of formats. Commented Dec 30, 2010 at 17:15
  • @George: By recognising all the various possibilities.
    – skaffman
    Commented Dec 30, 2010 at 17:15

3 Answers 3

4

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.

4
  • Then how do graphical FTP clients enumerate files? Commented Dec 30, 2010 at 17:13
  • @George Edison - they probably have a list of commonly used formats and parse those.
    – Oded
    Commented Dec 30, 2010 at 17:14
  • @George Edison - See the answer from @Eugene Mayevsky, these are apparently done through extensions to the FTP standard.
    – Oded
    Commented Dec 30, 2010 at 17:29
  • 2
    @NathanOsman - I looked into the code of FileZilla on Sourceforge, and... it's not pretty, heh. Trial and error of about a dozen different formats.
    – Nyerguds
    Commented Nov 13, 2013 at 14:35
4

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.

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.