ASP CopyFile Method

Definition and Usage

The CopyFile method copies one or more files from one location to another.

Syntax:

FileSystemObject.CopyFile source,destination[,overwrite]
Parameters Description
source Required. The file to be copied (wildcards can be used).
destination Required. The destination of the file copy (wildcards cannot be used).
overwrite Optional. Specifies whether to overwrite existing files. True allows overwriting existing files, False prevents existing files from being overwritten. The default is True.

Instance

<%
dim fs
set fs=Server.CreateObject("Scripting.FileSystemObject")
fs.CopyFile "c:\mydocuments\web\*.htm","c:\webpages\"
set fs=nothing
%>