GetFileTime Method  

Returns the modification date and time for specified file on the server.


object.GetFileTime( RemoteFile, FileDate )


A string that specifies the name of the file on the server. The filename cannot contain any wildcard characters and must follow the naming conventions of the operating system the server is hosted on.
A variable that will be set to the date and time that the file was last modified. The variable's data type must either be Variant, String or Date. This parameter must be passed by reference.

Return Value

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.


The GetFileTime method returns the modification date and time for the specified file on the server using the MTDM command. If the server does not support this command, the method will attempt to use the STAT command to determine the file modification time. You can use the Features property to determine what features are available and/or enabled on the server.

The Localize property will determine if the returned file time is adjusted for the local timezone.


The following example demonstrates how to retrieve the size a file on the server:

Dim dateFileTime As Date

nError = FtpClient1.GetFileTime(strFileName, dateFileTime)
If nError > 0 Then
    MsgBox FtpClient1.LastErrorString, vbExclamation
    Exit Sub
End If

MsgBox strFileName & " was modified on " & dateFileTime

See Also

Features Property, Localize Property, GetFileStatus Method, GetFileSize Method, SetFileTime Method