VerifyFile Method  
 

Verify that the contents of a file on the local system are the same as the specified file on the server..

Syntax

object.VerifyFile( LocalFile, RemoteFile, [Options] )

Parameters

LocalFile
A string that specifies the name of the file on the local system.
RemoteFile
A string that specifies the name of the file on the server.
Options
A numeric bitmask which specifies the options that may be used when comparing the files. This argument may be any one of the following values:
Value Constant Description
0 ftpVerifyDefault File verification should use the best option available based on the available server features. If the server supports the XMD5 command, the control 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 control 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 control will compare the size of the local and remote files.
1 ftpVerifySize 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.
2 ftpVerifyCRC32 Files are verified by calculating a CRC-32 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.
4 ftpVerifyMD5 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

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.

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 CRC-32 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.

See Also

BufferSize Property, Priority Property, GetData Method, GetFile Method, GetMultipleFiles Method, PutData Method, PutFile Method, OnGetFile Event, OnProgress Event