How Do you GET/Convert Time Date to MLST from FTP VB.NET

0 votes
asked Sep 8, 2015 by shacks (120 points)

What is required in code besides?
dim ftp1 as new
to change the time to MLST
(ftp1.settings.) in does not exist. That was the answer for fixing C#. We are using VB.NET.

Mine is an older version.


Applies to: Rebex FTP/SSL

1 Answer

0 votes
answered Sep 8, 2015 by Tomas Knopp (58,890 points)
edited Sep 9, 2015 by Lukas Pokorny


ftp.GetFileDateTime(remotepath) method automatically uses MLST command since version 2012R2 (if supported by the server). To take advantage of this, an update to at least version 2012R2 is required.

For more details on how to get the new version see my comment to your comment at the original question.

With 2012R1 and earlier, you can use the following method to determine file date/time using MLST command:

    Public Ahared Function GetFileDateTime(ftp As Ftp, path As String) as DateTime
        ftp.SendCommand("MLST " & path)
        Dim res As ftpresponse = ftp.ReadResponse()
        If res.Group <> 2 Then Throw New FtpException(res)

        dim facts As String = res.Raw.Split(Chr(10))(1).Trim()
        Dim raw() As String = { facts }
        Dim items = New FtpItemCollection(raw, FtpListingType.MachineProcessingList)
        Return items(0).LastWriteTime.Value
    End Function
commented Sep 8, 2015 by shacks (120 points)
I appreciate your answer, which was already given.  My question was actually not what is new in the product but what is the workaround for the older version?

So using the old version there was no way to get the right FTP time of the remote server, basically it was not complete in its ability to get the correct time date?
commented Sep 9, 2015 by Lukas Pokorny (128,250 points)
Rebex FTP/SSL 2012 R1 and earlier used MDTM command (an extension to the original FTP protocol) to determine file date/time with most FTP servers. This returns an UTC time for all servers that implement the MDTM command according to its specification, which states that GMT (UTC) time zone is to be used (see Unfortunately, not all server vendors implemented MDTM according to the specification (see

Rebex FTP/SSL 2012 R2 and later use MLST command (another extension to the FTP protocol) by default when available, which is more reliable (we are not currently aware of any FTP servers using a wrong time zone in MLST responses).

However, the old version works fine with servers that adhere to the MDTM specification. With these servers, it returns an UTC date/time (even though marked as 'Unspecified').

I added a code that uses MLST to determine file date/time with 2012 R1 and earlier to Tomas' answer.