Folder.Copy Method (VB6)

Named Arguments

Yes

Syntax

oFolderObj.Copy
						Destination [, OverwriteFiles]


oFolderObj

Use: Required

Data Type: Folder object

Any object variable returning a Folder object.


Destination

Use: Required

Data Type: String

The path and optionally the filename of the copy to be made.


OverwriteFiles

Use: Optional

Data Type: Boolean

Indicates whether existing files and folders should be overwritten (True) or not (False).

Description

Copies the current folder and its contents, including other folders, to another location.

Rules at a Glance

  • Wildcard characters can't be used in Destination.

  • The folder and all subfolders and files contained in the source folder are copied to Destination. That is to say, the Copy method is recursive.

  • Unlike the FileSystemObject.CopyFolder method, there is no operational difference between ending Destination with a path separator or not.

Programming Tips and Gotchas

  • If the destination path or any of the files contained in the Destination structure are set to read-only, the Copy method will fail regardless of the value of OverwriteFiles.

  • If OverwriteFiles is set to False, and the source folder or any of the files contained in the Destination structure exists in the Destination structure, then trappable error 58, "File Already Exists," is generated.

  • If an error occurs while copying more than one file, the Copy method exits immediately, leaving the rest of the files uncopied. There is also no roll-back facility to undo the copies prior to the error.

  • If the user has adequate rights, Destination can be a network path or share name. For example:

    oFolder.Copy "\NTSERV1d$RootTwo"
    								

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.248.53