复制代码 代码如下:
<%
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="2006" '原文件夹
FolderPath="2008" '目标文件夹
response.write""&CopyMyFolder(FolderName,FolderPath)&"" '复制文件夹2006下的所有内容到2008文件夹下并返回结果
%>
<%
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="2006" '原文件夹
FolderPath="2008" '目标文件夹
response.write""&CopyMyFolder(FolderName,FolderPath)&"" '复制文件夹2006下的所有内容到2008文件夹下并返回结果
%>
标签:
asp复制文件夹代码
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“asp复制文件夹代码”评论...