FileSystemObject.CopyFile() : FileSystemObject : MS JScript JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » MS JScript » FileSystemObject »

 

FileSystemObject.CopyFile()












Syntax








filesystemobject.CopyFile(source, destination, overwrite)



The CopyFile() method is used to copy one or more files to a specified directory.

source specifies source path and filename.

destination specifies destination path a filename.

overwrite is a Boolean value indicating whether to overwrite an existing file or not.












<html>
    <body>
    <script language="JScript">
    <!--
    function copy()
    {
        var myObject, newpath;
        myObject = new ActiveXObject("Scripting.FileSystemObject");
        myObject.CopyFile ("c:\test.txt""c:\tmp\myTest.txt");
    }
    -->
    </script>
    Copy "c:test.txt" to the existing path: "c:tmpmyTest.txt"
    <form name="myForm">
    <input type="Button" value="Copy File" onClick='copy()'>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo MS JScript
» FileSystemObject