asp遍历站点所有文件夹的代码_ASP教程-查字典教程网
asp遍历站点所有文件夹的代码
asp遍历站点所有文件夹的代码
发布时间:2016-12-29 来源:查字典编辑
摘要:--请选择--整个站点当前目录

<>

<style>

<>

</style>

<scriptlanguage="vbscript">

<>

</script>

<formname="form1"method="post"action="findfolder.asp">

<selectsize="1"name="fpath"onchange="fsubmit()">

<optionvalue="0"selected>--请选择--</option>

<optionvalue="/">整个站点</option>

<optionvalue=".">当前目录</option>

<%

Dimfso,objfolder,objfile,strpath

setfso=server.createobject("Scripting.FileSystemObject")

strpath="."

callbl(strpath)

functionbl(strpath)

setobjfolder=fso.getfolder(server.mappath(strpath))

foreachobjsubfolderinobjfolder.subfolders

Response.write"<optionvalue='"&strpath&""&objsubfolder.name&"'>"&replace(strpath,".","")&""&objsubfolder.name&"</option>"

callbl(strpath&""&objsubfolder.name)

next

Endfunction

%>

</select>

</form>

<%

fpath=Request.form("fpath")

iffpath<>"0"andfpath<>Emptythen

Response.write"<fontcolor=""#FF0000"">当前文件夹:"&replace(fpath,".","")&"</font><br><br>"

setobjfolder=fso.getfolder(server.mappath(fpath))

foreachobjsubfolderinobjfolder.subfolders

Response.write"子文件夹名称:"&objsubfolder.name&"<br>"

next

Response.write"<br>"

foreachobjfileinobjfolder.files

Response.write"文件名称:"&objfile.name&"<br>"

next

setobjfolder=nothing

Endif

%>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新ASP教程学习
    热门ASP教程学习
    编程开发子分类