CopyRecord Method (ADO)

Microsoft ActiveX Data Objects (ADO)

CopyRecord Method

       

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

Syntax

CopyRecord (Source, Destination, UserName, Password, Options, Async)

Parameters

Source   Optional. A String value that contains a URL specifying the file or directory to be copied. If Source is omitted or specifies an empty string, the file or directory represented by this Record will be copied.

Destination   Optional. A String value that contains a URL specifying the location where Source will be copied.

UserName   Optional. A String value that contains the user ID that, if needed, authorizes access to Destination.

Password   Optional. A String value that contains the password that, if needed, verifies UserName.

Options   Optional. A CopyRecordOptionsEnum value that has a default value of adCopyUnspecified. Specifies the behavior of this method.

Async   Optional. A Boolean value that, when True, specifies that this operation should be asynchronous.

Return Value

A String value that typically returns the value of Destination. However, the exact value returned is provider-dependent.

Remarks

The values of Source and Destination must not be identical; otherwise, a run-time error occurs. At least one of the server, path, or resource names must differ.

All subdirectories of Source are copied recursively, unless adCopyNonRecursive is specified. In a recursive operation, Destination must not be a subdirectory of Source; otherwise, the operation will not complete.

This method fails if Destination identifies an existing file or directory, unless adCopyOverWrite is specified.

Important   Use the adCopyOverWrite option judiciously. For example, specifying this option when copying a file to a directory will delete the directory and replace it with the file.