asp复制文件夹代码
2018-09-06 11:55
复制代码 代码如下:
<%
FunctionCopyMyFolder(FolderName,FolderPath)
sFolder=server.mappath(FolderName)
oFolder=server.mappath(FolderPath)
setfso=server.createobject(scripting.filesystemobject)
iffso.folderexists(server.mappath(FolderName))Then检查原文件夹是否存在
iffso.folderexists(server.mappath(FolderPath))Then检查目标文件夹是否存在
Else目标文件夹如果不存在就创建
CreateNewFolder=Server.Mappath(FolderPath)
fso.CreateFolder(CreateNewFolder)
fso.copyfoldersFolder,oFolder
Endif
CopyMyFolder=复制文件夹[&server.mappath(FolderName)&]到[&server.mappath(FolderPath)&]成功!
Else
CopyMyFolder=错误,原文件夹[&sFolde&]不存在!
EndIf
setfso=nothing
EndFunction
FolderName=2006原文件夹
FolderPath=2008目标文件夹
response.write&CopyMyFolder(FolderName,FolderPath)&复制文件夹2006下的所有内容到2008文件夹下并返回结果
%>
下一篇:asp创建用户目录和站点