GlobalSCAPE Knowledge Base

Conserve Local File Time feature doesn't work properly when connected to Serv-u FTP



  • CuteFTP Pro®, all versions


Conserve Local File Time feature does not work properly when connected to Serv-u FTP Server


The MDTM command is used for retrieving a file's time from the server. However, CuteFTP and various other FTP clients also use the MDTM command to change or set an uploaded file's timestamp as well.

The official draft documenting the MDTM command (draft-ietf-ftpext-mlst-16.txt) makes no provisions for using the MDTM command to set the file timestamp, so various clients and servers end up implementing the command differently.

The typical command syntax is MDTM YYYYMMDDHHMMSS FILENAME, where HHMMSS is either the client's actual local time zone, or in the case of some FTP clients, GMT (Greenwich Meridian Time), which mimics the retrieve behavior of MDTM as documented in section 2.3 of the afore-mentioned IETF draft.

A couple of servers, such as Serv-u, have extended the MDTM command even further, adding a time zone parameter to the end of the MDTM command, as follows: MDTM YYYYMMDDHHMMSS[+-TZ] FILENAME.

CuteFTP does not support this proprietary [+-TZ] parameter. CuteFTP sends the local time for the HHMMSS portion of the MDTM command sequence, not the GMT time. However, Serv-u and some other FTP servers expect the time to be sent in GMT, and automatically adjust the time for the file, causing it to be different than what the client expects.

For example:

CuteFTP retrieves a listing. File time shows 8:55 AM:

-rw-rw-rw-   1 user     group       20249 May 14 08:55 Reports.cfc

CuteFTP does an MDTM retrieve time to determine what the remote file's time is.
The server sends 12:55 PM, adding 4 hours. due to the server's time difference
and GMT:

COMMAND:>       MDTM Reports.cfc
213 20040514125501

CuteFTP uploads the replacement Reports.cfc file:

STOR Reports.cfc

CuteFTP issues an MDTM command to set the time according the actual date and local
time of the file, 12:55 PM:

COMMAND:>       MDTM 20040514125501 Reports.cfc

Subsequently we retrieve the list from the server. The time, 8:55 AM.

-rw-rw-rw-   1 user     group       20249 May 14 08:55 Reports.cfc

Notice that the server did not write the 12:55 timestamp as requested. Instead, it assumed the timestamp was in GMT and subtracted 4 hours.

Note: Do not turn on this feature when connecting to Serv-U or other FTP servers that modify the time sent as part of the MDTM set sequence.

Last Modified: Last Year
Last Modified By: kmarsh
Type: INFO
Rated 1 star based on 4 votes.
Article has been viewed 30K times.
Also In This Category