Timestamp Difference for FTP Directory Browsing

 

If you are familiar with FTP services shipped with Windows Server, you will know there are two directory listing styles available,

(Picture link: https://farm3.static.flickr.com/2571/4003532769_98995b000d_o.png)

Then what is the difference between UNIX and MS-DOS? I cannot list them all in this post but I will discuss about one significant difference that can lead to problems, the timestamp part.

*The Problem*

I have a few files in an FTP site. This is how they look in Windows Explorer.

 ftp1.png

When I use MS-DOS style for FTP directory listing, I can see this page in IE8,

2.png 

But once I switch to UNIX style, the page suddenly changes to this one,

ftp3.png

Why LogonUser.zip’s timestamp changes?

*The Reason and Background*

https://support.microsoft.com/default.aspx?scid=kb;EN-US;256312

This KB article actually documents the reason. As in UNIX style the time section is not returned from the server to the client, IE can only show the date section correctly. 12:00AM is displayed as time section in this case.

FTP is an open standard, which is documented in IETF RFC959 (https://www.ietf.org/rfc/rfc959.txt) and other accompanying documents. However, the LIST command defined in it does not have a clear hint on how to implement it. So different FTP service vendors choose different ways and finally lead to two main branches now, UNIX style and MS-DOS style.

*Fill the Gap*

So if I would like to know the exact timestamp for LogonUser.zip in this case, is it possible?

The answer is YES. There is an additional FTP command for timestamp purpose named MDTM (documented in RFC3659 https://tools.ietf.org/html/rfc3659).

ftp> literal MDTM LogonUser.zip

213 20081117122539

Using it you can know the timestamp in GMT for a specific file.

However, most FTP client software, such as Internet Explorer does not make use of MDTM even if UNIX style is used on server side. I think this is because not all FTP service vendors now support RFC3659 fully.

Therefore, if you are going to define a protocol, make sure that you prevent such branching from the start.

*Reference*

In section 5.3 of this page (https://linux.math.tifr.res.in/manuals/html/wget/wget_5.html#SEC25) there is an interesting discussion on this topic.

Regards,

Lex Li