递归查找一文件夹中是否有asp文件,出现内存不够提示?

flyintosky555 2004-08-03 09:04:45
dim StrFolder
dim result

StrFolder=request("folder")
result=CheckFileSecurity(StrFolder)
if len(result)>0 then
response.write result
else
response.write "<script language=javascript>alert('该文件夹无危险文件');window.history.back(-1);</script>"
end if

Function CheckFileSecurity(StrFolder)
dim fs,fd,sfd,f
dim whatever
dim strfmt
dim badFile
set fs=server.createObject("Scripting.FileSystemObject")
CheckFileSecurity=true
set fd=fs.getfolder(server.MapPath("/demo/" &StrFolder))
set f=fd.files
for each whatever in f
strfmt=GetFileFmt(cstr(whatever.Name))
if strfmt="asp" then
badFile=badFile & whatever.Name
end if
next
set sfd=fd.subfolders
for each whatever in sfd
'call CheckFileSecurity(whatever.name) '加上这一句就出错
next
set fs=nothing
CheckFileSecurity=badFile
end Function
'得到文件扩展名
function GetFileFmt(StrFile)
dim TmpStr
dim Length
dim t
StrFile=lcase(StrFile)
Length=len(StrFile)
do while length>0
TmpStr=mid(StrFile,Length,1)
if TmpStr="." then
GetFileFmt=right(StrFile,t)
exit do
else
Length=Length-1
t=t+1
end if
loop
end function

我要查找的文件夹里可能有子文件夹,子文件夹里还有可能有子文件夹,要全部检查这些文件夹里是否有asp文件。但加上call CheckFileSecurity(whatever.name) 这一句就出错,不加的话实际上之检查到第一级文件,该怎么办?
...全文
103 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
mind_1220 2004-08-04
  • 打赏
  • 举报
回复
加内存。
flyintosky555 2004-08-04
  • 打赏
  • 举报
回复
up

28,409

社区成员

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

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