复制代码 代码如下:
<%
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""©myfolder(foldername,folderpath)&"" '复制文件夹2006下的所有内容到2008文件夹下并返回结果
%>
申明:本教程内容由威凡网编辑整理并提供IT程序员分享学习,如文中有侵权行为,请与站长联系(QQ:254677821)!