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.
strSourcecan 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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access