SetRemoteFileDateTime – Not all FTP servers support setting remote file date/time

Explicitly setting the date/time for a file on the FTP server is not a well defined task w/ the FTP protocol. Some servers support the MDTM command. However, MDTM is officially for getting a remote file’s date/time. Some FTP servers allow for using MDTM to set a remote file’s date/time (even though this is not a standard). Some FTP servers also support an ad-hoc non-standard command called “SITE UTIME”. If your application calls SetRemoteFileDateTime, it will first try MDTM, and if it fails, it will then try SITE UTIME. If one succeeds, it will be remembered in the FTP2 object instance so that the next time SetRemoteFileDateTime is called, it will choose the command that works the 1st time.  Here is a sample LastErrorText for the case where an FTP server does not support either:

DllDate: Dec 20 2008
UnlockPrefix: ***
Username: ***
Component: .NET 2.0
Trying MDTM...
Trying SITE UTIME...
Tags :