asp 通过fso 复制文件目录 文件夹的源代码
asp 复制文件夹的源码
<%
Function CopyMyFolder(FolderName,FolderPath)sFolder=server.mappath(FolderName)
oFolder=server.mappath(FolderPath)
set fso=server.createobject("scripting.filesystemobject")
if fso.folderexists(server.mappath(FolderName)) Then'检查原文件夹是否存在
if fso.folderexists(server.mappath(FolderPath)) Then'检查目标文件夹是否存在
fso.copyfolder sFolder,oFolder
Else '目标文件夹如果不存在就创建
CreateNewFolder = Server.Mappath(FolderPath)
fso.CreateFolder(CreateNewFolder)
fso.copyfolder sFolder,oFolder
End if
CopyMyFolder="复制文件夹["&server.mappath(FolderName)&"]到["&server.mappath(FolderPath)&"]成功!"
Else
CopyMyFolder="错误,原文件夹["&sFolde&"]不存在!"
End If
set fso=nothing
End Function
FolderName="test/zzzyk.com" '原文件夹
FolderPath="test/yizuotu.net" '目标文件夹
response.write""&CopyMyFolder(FolderName,FolderPath)&""
%>