Recursively copies a folder from one location to another.
object.CopyFolder ( source, destination[, overwrite] );
Wildcard characters can only be used in the last path component of the source argument. For example, you can use:
[JScript]
fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CopyFolder ("c:\\mydocuments\\letters\\*
", "c:\\tempfolder\\")
[VBScript]
FileSystemObject.CopyFolder "c:\mydocuments\letters\*", "c:\tempfolder\"
But you cannot use:
[JScript] fso = new ActiveXObject("Scripting.FileSystemObject"); fso.CopyFolder ("c:\\mydocuments\\*
\\*
", "c:\\tempfolder\\") [VBScript] FileSystemObject.CopyFolder "c:\mydocuments\*\*", "c:\tempfolder\"
If source contains wildcard characters or destination ends with a path separator (\), it is assumed that destination is an existing folder in which to copy matching folders and subfolders. Otherwise, destination is assumed to be the name of a folder to create. In either case, four things can happen when an individual folder is copied.
An error also occurs if a source using wildcard characters doesn't match any folders.
The CopyFolder method stops on the first error it encounters. No attempt is made to roll back any changes made before an error occurs.
CopyFile Method | Copy Method | CreateFolder Method | DeleteFolder Method | MoveFolder Method
Applies To: FileSystemObject Object