fso 文件夹建立问题 请高手看看

eshoweshow 2008-07-03 03:08:52
<table width="100%" height="197" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="tableBorder">
<tr><form method="post" action="Img.asp?action=Backup">
<td width="100%" height="89" align="left" valign="top" bgcolor="#f1f1f1" >
<input type=text size=24 name=DBpath value="0" style="display:none;">新建文件夹:<input type=text size=24 name=bkfolder value="" onFocus="this.select();"> <input name="submit" type=submit value="开始创建" class="button" >
</td>

</form><%
if request("action")="Backup" then
Dbpath=server.mappath(request.form("Dbpath"))
bkfolder=request.form("bkfolder")
Set Fso=server.createobject("Scripting.FilesystemObject")
if fso.FolderExists(dbpath) then
If CheckDir(bkfolder) = True Then
fso.copyfolder dbpath,bkfolder
else
MakeNewsDir bkfolder
fso.copyfolder dbpath,bkfolder
end if
response.write "<script>alert('创建成功!');location.href='IMG.asp';</script>"
else
response.write "<script>alert('找不到您所需要备份的文件!');history.go(-1);</script>"
end if
end if

Function CheckDir(FolderPath)
folderpath=Server.MapPath(".")&"\"&folderpath
Set fso1 = CreateObject("Scripting.FilesystemObject")
If fso1.FolderExists(FolderPath) then
CheckDir = True
Else
CheckDir = False
End if
Set fso1 = nothing
End Function

Function MakeNewsDir(foldername)
Set fso1 = CreateObject("Scripting.FilesystemObject")
Set f = fso1.CreateFolder(foldername)
MakeNewsDir = True
Set fso1 = nothing
End Function
%>
</table>



如果没有这个文件夹 就可以建立
如果有 就不能建立 提示 已经有该文件夹

帮忙看看
...全文
74 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
bhtfg538 2008-07-08
  • 打赏
  • 举报
回复
Set Fso=server.createobject("Scripting.FilesystemObject")
if Fso.FolderExists(Server.Mappath("路径"))=true then
Response.write("存在")
else
Fso.CreateFolder(Server.Mappath("路径"))
end if
wp8888888 2008-07-08
  • 打赏
  • 举报
回复
你可以当那个文件夹存在时选择删除或者重命名就可以了。。。
eshoweshow 2008-07-07
  • 打赏
  • 举报
回复
建立的之前检查文件夹是否存在,然后决定是否建立~
Anlige 2008-07-04
  • 打赏
  • 举报
回复
建立的之前检查文件夹是否存在,然后决定是否建立~
kqogje 2008-07-04
  • 打赏
  • 举报
回复
看着像没有什么毛病啊?
jhwcd 2008-07-04
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 loska 的回复:]
不明白楼主的问题!
[/Quote]
把要说明的问题说的详细点。
micool 2008-07-04
  • 打赏
  • 举报
回复
看一下iis配置
loska 2008-07-04
  • 打赏
  • 举报
回复
不明白楼主的问题!
eshoweshow 2008-07-04
  • 打赏
  • 举报
回复
ding!
Dogfish 2008-07-03
  • 打赏
  • 举报
回复
server.mappath 好像经常不准的。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧