Open In App

ASP CopyFolder Method

Last Updated : 02 Mar, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The ASP CopyFolder Method is used to copying one or more folders from source to destination. It is a predefined method of the FileSystem Object. 

Syntax:

FileSystemObject.CopyFolder source,destination[,overwrite] 

Parameter Values:

  • source: It is a required attribute. It contains a Character string file that can include wildcard characters, for one or more folders to be copied.
  • destination: It is also a required attribute. It specifies a character string value Where to copy the folder or folders. It does not include wildcard characters.
  • overwrite: It contains a Boolean value which indicates that whether an existing folder can be overwritten or not. True, files are overwritten; if False, they are not. The default is True. Note that CopyFile will fail if the destination has the read-only attribute set, regardless of the value of overwriting.

Example: Below example demonstrates the CopyFolder Method.

Javascript




<%
'copy all the folders in c:\myfolders\hello
'to the folder c:\pictures
  
dim fs
set fs=Server.CreateObject("Scripting.FileSystemObject")
fs.CopyFolder "c:\myfolders\hello\*","c:\pictures\"
response.write("Folder Copied")
set fs=nothing
%>


Output:

Folder Copied

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads