JavaScript中Copy函数是将指定文件或文件夹从一个位置复制到另一位置。使用方式是:

  object.Copy

  ( destination[, overwrite] );

  其中object是必选项。 应为 File 或 Folder 对象的名称。

  destination是必选项。 复制文件或文件夹的目的位置。 不允许通配字符。

  overwrite是可选项。 Boolean 值,如果要覆盖已有文件或文件夹,则为 True (默认);否则,则为 False 。

  Copy 方法对单个 File 或 Folder 所产生的结果和使用 FileSystemObject.CopyFile 或 FileSystemObject.CopyFolder 所执行的操作结果一样,其中,后者把由 object 所引用的文件或文件夹作为参数传递。 但是请注意,后两种替换方法能够复制多个文件或文件夹。

  下面的例子说明了 Copy 方法的用法。

var fso, f;http://www.82676666.com
  fso = new ActiveXObject("Scripting.FileSystemObject");
  f = fso.CreateTextFile("c:\\testfile.txt", true);
  f.WriteLine("This is a test.");
  f.Close();
  f = fso.GetFile("c:\\testfile.txt");
  f.Copy("c:\\windows\\desktop\\test2.txt");