Name

CopyFolder (FileSystemObject Object) — fsoObj .CopyFolder strSource, strDestination [, blnOverWrite ]

Synopsis

Allows you to copy a folder and all of its contents from one location to another.

Parameters

strSource

A string value that represents the full path of the location from which you wish to copy a folder or folders. strSource can include wildcard characters.

strDestination

A string value that represents the full path of the location to which you wish to copy the folder or folders designated by strSource.

blnOverWrite

A Boolean value that indicates whether a file of the same name as the file to be copied will be overwritten. The default is True.

Example

<%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Use the FileSystemObject object's CopyFolder method
' to copy the Temp directory and all its contents from
' the C drive to the D drive, overwriting if necessary.
fsoObject.CopyFolder "c:\temp", "d:\temp", True
. . . [additional code]

%>

Notes

If an error is raised when calling CopyFolder, the method stops immediately and does not reverse any actions already performed.

The CopyFolder method is as fast as copying the folder using the command line.

Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.