CopyFolder Method

 

Description

 

Recursively copies a folder from one location to another.

 

PowerBASIC Syntax

 

METHOD CopyFolder ( _

BYVAL bstrSource AS STRING, _

BYVAL bstrDestination AS STRING, _

OPTIONAL BYVAL bOverwrite AS INTEGER _

)

 

Arguments

 

bstrSource

BSTR. Character string file specification, which can include wildcard characters, for one or more folders to be copied

bstrDestination

BSTR. Character string destination where the folder and subfolders from source are to be copied. Wildcard characters are not allowed.

bOverwrite

Boolean value that indicates if existing folders are to be overwritten. If true, files are overwritten; if false, they are not. The default is true.

 

Remarks

 

Wildcard characters can only be used in the last path component of the source argument.

 

Example [PowerBASIC]

 

#INCLUDE "windows.inc"

#INCLUDE "scrrun.inc"

 

DIM fso AS IFileSystem

 

' Create an instance of the FileSystemObject

fso = NEWCOM "Scripting.FileSystemObject"

' Copy a folder

fso.CopyFolder UCODE$("C:\MyFolder"), UCODE$("C:\MyNewFolder"), %FALSE

IF OBJRESULT = %S_OK THEN

  MSGBOX "Folder copied"

ELSE

  MSGBOX "Error &H" & HEX$(OBJRESULT) & " copying the folder"

END IF

 

Valid XHTML 1.0 Transitional