最新的Web开发教程
 

ASP复制方法


<完整的文件对象参考

复制方法复制指定的文件或文件夹从一个位置到另一个位置。

句法

FileObject.Copy(destination[,overwrite])

FolderObject.Copy(destination[,overwrite])

参数 描述
destination 需要。 当复制的文件或文件夹。 通配符不允许
overwrite 可选的。 指示是否一个现有的文件或文件夹的布尔值可以被覆盖。 True表示文件/文件夹可以被覆盖,false表示文件/文件夹不能被覆盖。 默认为true。

例如,对于文件对象

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.txt")
f.Copy("c:\new_test.txt",false)
set f=nothing
set fs=nothing
%>

例如,对于文件夹对象

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
fo.Copy("c:\new_test",false)
set fo=nothing
set fs=nothing
%>

<完整的文件对象参考