D. J. Bernstein
Internet publication
FTP: File Transfer Protocol
The LIST and NLST verbs
/bin/ls format
/bin/ls format is a series of lines terminated by \015\012.
Servers using /bin/ls format
need to be prepared to generate lines in the following form:
-rw-r--r-- 1 owner group 213 Aug 26 16:31 README
The line contains
- - for a regular file
or d for a directory;
- the literal string rw-r--r-- 1 owner group for a regular file,
or rwxr-xr-x 1 owner group for a directory;
- the file size in decimal right-justified in a 13-byte field;
- a three-letter month name, first letter capitalized;
- a day number right-justified in a 3-byte field;
- a space and a 2-digit hour number;
- a colon and a 2-digit minute number;
- a space and the abbreviated pathname of the file.
File names containing spaces, stars, hyphens, or slashes
will be misinterpreted by some clients,
and must be omitted from the list.
The month name, day number, hour number, and minute number
express the file's modification time
in the server's local time zone.
This creates several obstacles to reliable mirroring.
The format shown above applies only to files
modified in the last six months.
Other files show the year instead of the hour number and minute number:
-rw-r--r-- 1 owner group 1383 Apr 10 1997 ip.c
Some servers (e.g., NetWare) set the cutoff at one year,
making it impossible for the client to reliably distinguish
dates near the cutoff from recent dates.
Clients attempting to parse /bin/ls format
must be prepared for a much wider range of line formats.
All the formats I've seen are documented in
https://cr.yp.to/ftpparse.html.