CFtpClient::SetFileTime Method  
 
INT SetFileTime(
  LPCTSTR lpszFileName,  
  LPSYSTEMTIME lpFileTime  
);

The SetFileTime method sets the modification time for the specified file on the server.

Parameters

lpszFileName
Points to a string that specifies the name of the remote file.
lpFileTime
Points to a SYSTEMTIME structure that specifies the new modification time for the remote file.

Return Value

If the method succeeds, the return value is the server result code. If the method fails, the return value is FTP_ERROR. To get extended error information, call GetLastError.

Remarks

The SetFileTime method will change the modification time of a file on the server. The values specified in the SYSTEMTIME structure are expected to represent UTC time, not time adjusted for the local system's timezone. If the values do represent the local time, it must be converted to UTC time prior to calling this method. To populate the SYSTEMTIME structure with the current time, use the GetSystemTime method.

When connected to an FTP server, this method uses the MDTM command to set the modification time for the specified file. Not all servers implement this command, in which case the method call will fail. Note that some servers only support the MDTM command to return, but not change, the file modification time.

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csftpv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

GetFileStatus, GetFileTime, OpenDirectory