CFtpClient::VerifyFile Method  
 
BOOL VerifyFile(
  LPCTSTR lpszLocalFile,  
  LPCTSTR lpszRemoteFile,  
  DWORD dwOptions  
);

The VerifyFile method attempts to verify that the contents of a file on the local system are the same as the specified file on the server.

Parameters

lpszLocalFile
A pointer to a string that specifies the name of file on the local system.
lpszRemoteFile
A pointer to a string that specifies the name of the file on the server.
dwOptions
Specifies the options that may be used when comparing the files. This parameter may be one or more of the following values:
Value Description
FTP_VERIFY_DEFAULT File verification should use the best option available based on the available server features. If the server supports the XMD5 command, the class will calculate an MD5 hash of the local file contents and compare the value with the file on the server. If the server does not support the XMD5 command, but it does support the XCRC command, the class will calculate a CRC32 checksum of the local file contents and compare the value with the file on the server. If the server does not support either the XMD5 or XCRC commands, the class will compare the size of the local and remote files.
FTP_VERIFY_SIZE Files are verified by comparing the number of bytes of data in the local and remote files. This is the least reliable method, and should only be used if the server does not support either the XMD5 or XCRC commands.
FTP_VERIFY_CRC32 Files are verified by calculating a CRC32 checksum of the local file contents and comparing it with the value returned by the server in response to the XCRC command. This method should only be used if the server does not support the XMD5 command.
FTP_VERIFY_MD5 Files are verified by calculating an MD5 hash of the local file contents and comparing it with the value returned by the server in response to the XMD5 command. This is the preferred method for performing file verification.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The VerifyFile method will attempt to verify that the contents of the local and remote files are identical using one of several methods, based on the features that the server supports. Preference will be given to the most reliable method available, using either an MD5 hash, a CRC32 checksum or comparing the size of the file, in that order.

It is not recommended that you use this method with text files because of the different end-of-line conventions used by different operating systems. For example, a text file on a Windows system uses a carriage-return and linefeed pair to indicate the end of a line of text. However, on a UNIX system, a single linefeed is used to indicate the end of a line. This can cause the VerifyFile method to indicate the files are not identical, even though the only difference is in the end-of-line characters that are used.

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

DeleteFile, GetFile, PutFile