File.Copy()

JScript3.0+Syntax

							file.Copy(destination, overwrite)

Description

The Copy() method is used to copy a specified file from one location to another. This method takes two parameters. destination is the location to which to copy the file. overwrite is a Boolean value indicating whether to overwrite an existing file of the same name.

Example

Listing 9.51 shows how to use the Copy() method to copy the test.txt file to mytest.txt.

Listing 9.51 Example of Copy()
 <html> <BODY> <script language="JScript"> <!-- Hide // function creates a new file object and then copies it to // another file. function copy() { var myObject, f; //Create an instance of the FileSystemObject myObject = new ActiveXObject("Scripting.FileSystemObject"); f = myObject.file.copy("c:\\test.txt", ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.