Updated April 11, 2017
This article describes how to preserve the original time stamp of an uploaded file using the MDTM command. With the MDTM command, any FTP client that also supports this command can upload a file and preserve the time and date stamp on the file.
At the time of this writing, not many FTP client programs support the MDTM command. FTP Voyager supports this command. The command line FTP client lets you send this by adding the MDTM command, using the format
mdtm 19980525162603 file.txt.
This command originates in UNIX and lets you query the server for the modification date and time of a file or directory. Unlike UNIX, the Serv-U FTP also lets the client set the modification date and time of files on the server, if the user has sufficient access rights. This is useful in synchronizing uploaded files with those on the client.
Normally, the FTP gets the date the files were created on the server and has no way to explicitly set the date of uploaded files. MDTM lets the client change that so they get the date of the original file on the server. This also works for directories.
The syntax to set the date and time is
MDTM yyyymmddhhmmss[+-xxx], where
yyyymmddhhmmss is a line of text with the year, month, day, hour, minutes, and seconds the file should get set to. The
[+-xxx]part is optional time zone information of the FTP client, in minutes relative to UTC. If the client provides this information, the Serv-U FTP converts the date and time to the local time at the server. Dates and times are kept consistent. For example, a file created at 04:00 EST will be created at 10:00 CET. If time zone information is unavailable, the Serv-U FTP assumes the local time at the server.
As an example, if the client is in the Eastern US during summer time, entering
MDTM 19980719103029-240 sets the date and time to 19 July 1998, 10:30 AM 29 seconds, and indicates that the client is 240 behind UTC.
All Serv-U versions