asp复制文件夹代码
程序员文章站
2023-11-27 13:45:58
复制代码 代码如下:<% function copymyfolder(foldername,folderpath) sfolder=server.mappa...
复制代码 代码如下:
<%
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文件夹下并返回结果
%>
上一篇: TSYS资源特性的效率提高方法
下一篇: 旁注-网站小助手旭方修改免杀asp版