Name
Copy (File Object, Folder Object) —
obj
.Copy
strDestination
[,
blnOverWrite
]
Synopsis
Copies a file from one location to another.
Parameters
-
strDestination A string value that represents the full path of the location to which you wish to copy the current file.
-
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
Dim filObject ' File Object
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
"Scripting.FileSystemObject")
' Using the GetFile method of fsoObject, initialize
' the File object.
Set filObject = fsoObject.GetFile("d:\docs\test.txt")
' Copy the file to a temporary directory.
filObject.Copy "e:\storage\temp\test_copy.txt", True
. . . [additional code]
%>Notes
The Copy method performs exactly the same function as the CopyFile and CopyFolder methods of the FileSystemObject object. However, it is important to note that the CopyFile and CopyFolder methods will allow you to copy more than one file or folder at a time.
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