Mega Code Archive

 
Categories / JavaScript Tutorial / MS JScript
 

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:\tmp\myTest.txt"     <form name="myForm">     <input type="Button" value="Copy File" onClick='copy()'>     </form>     </body>     </html>