Skip to content
Related Articles

Related Articles

Improve Article

ASP CopyFile Method

  • Last Updated : 23 Feb, 2021

The ASP CopyFile Method is used to copying one or more files from one place to another place. It is a predefined method of the FileSystem Object.


FileSystemObject.CopyFile 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 files to be copied.
  • destination: It is also a required attribute. It specifies a character string value Where to copy the file or files. It does not include wildcard characters.
  • overwrite: It contains a Boolean value which indicates that whether an existing file can be overwritten or not. True, files are overwritten; if False, they are not. The default is True. Note that CopyFile will fail if destination has the read-only attribute set, regardless of the value of overwrite.

Example Code: Below example demonstrates the CopyFile Method. 


dim gfg
set gfg=Server.CreateObject("Scripting.FileSystemObject")
gfg.CopyFile "c:\Folder1\A\*.txt","c:\Folder2\"
response.write("File is Copied")
set gfg=nothing


File is Copied 
My Personal Notes arrow_drop_up
Recommended Articles
Page :