VBScript » File » Copy

Version: 3.0

Syntax:
object.Copy destination[, overwrite]
overwrite
This is a Boolean value. If it is true, existing files with the same name as destination will be overwritten.
destination
Receives the path and filename where the file wil be copied.

This method copies the selected file to the specified destination.

The overwrite parameter is a Boolean value - True allows existing files with the same name as destination to be overwritten while False (the default) does not.

Examples

Code:
<%
dim filesys, demofile
set filesys = CreateObject ("Scripting.FileSystemObject")
set demofile = filesys.CreateTextFile ("c:\somefile.txt", true)
set demofile = filesys.GetFile("c:\somefile.txt")
demofile.Copy("c:\projects\someotherfile.txt")
%>
Explanation:

Note that after copying a file to a new location the File object still relates to the original file.