ADO » Record » CopyRecord

Version: 2.5

Syntax:
CopyRecord Source, Destination, UserName, Password, Options, Async
Source
The optional Source parameter is a string that is the URL of the file or directory that is to be copied. If you do not provide a value or provide the empty string, the default value will be the file or directory where the referenced Record object resides.
Destination
The optional Destination parameter is a string that is the URL into which the file or directory is to be copied. The values of the Source and Destination parameters must be different, or a run-time error will occur.
UserName
The optional UserName parameter is a string that is the user name of a person who has authorization to access the destination locale.
Password
The optional Password parameter is a string that is the password that authenticates the UserName parameter.
Options
The optional Options parameter is a CopyRecordOptionsEnum constant that specifies the behavior of this method. The default is adCopyUnspecified.
Async
The optional Async parameter is a Boolean value. If True, the operation can be asynchronous. If False, which is the default, the operation is synchronous.

Copies a file, or a directory and its contents, to a specified location.

The CopyRecord method is used to copy a file or a directory and its contents from a source location to a destination location. The default is to not allow over write or recursive copy. If you do specify recursion, the destination location may not be a subdirectory of the source location.

This method will return a string value that is usually the value of the Destination parameter, but the exact value that is returned is provider-dependent.

There are six optional parameters.

CopyRecordOptionsEnum Constants
 

Constant Value Description
adCopyAllowEmulation 4 If the attempt to copy the records failed, because the Destination is on a different server or uses a different provider than the Source, then the Source provider can attempt to simulate the copy by using upload, download, and delete operations.
adCopyNonRecursive 2 Copies the directory, but not any subdirectories
adCopyOverWrite 1 Can overwrite existing file or directory at destination
adCopyUnspecified -1 Default, does not allow overwrite or recursive copy

Examples

Code:
objRecord.CopyRecord strSourceURL, strDestinationURL, , , adCopyOverWrite
...
objRecord.Close
...
objRecord.Open strDestinationURL

See Also: