<%   
Option     Explicit   
dim     infopath                       '当前路径   
dim     serverpath                   '服务器路径   
dim     objfso                           '文件组件   
dim     objfile                         '文件   
dim     objfolder                     '目录   
dim     objfoldercontents     '所有文件   
dim     objfoldercount           '临时数组变量-文件夹   
dim     objfileitem                 '临时数组变量-文件   
  
infopath=request.servervariables("path_info")         '得到文件相对路径   
serverpath=server.mappath(infopath)                                     '得到文件绝对路径   
   
set     objfso=createobject("scripting.filesystemobject")         '实例文件组件   
set     objfile=objfso.GetFile(serverpath)                        '读取文件所在路径   
set     objfolder=objfile.parentfolder                            '根据文件所在路径得到上级目录   
   
set     objfoldercontents=objfolder.files                                         '所有文件付给数组   
response.write     "<table     width=100%     border=1><tr>"   
response.write     "<td>文件名</td>"   
response.write     "<td>文件属性</td>"   
response.write     "<td>文件大小</td>"   
response.write     "<td>更新日期</td></tr>"   
   
   
for     each     objfoldercount     in     objfolder.subfolders                     '循环显示文件夹   
response.write     "<tr><td><a     href=?path="&objfoldercount.name&">"&objfoldercount.name&"</td>"     '文件夹名称   
response.write     "<td>"&objfoldercount.type&"</td>"                   '文件夹属性   
response.write     "<td>       </td>"                                                             '文件夹大小   
response.write     "<td>"&objfoldercount.DateCreated&"</td>"     '时间   
next   
   
   
for     each     objfileitem     in     objfoldercontents                                 '循环   

If getExt(objfileitem.name)="gif" or getExt(objfileitem.name)="png" or getExt(objfileitem.name)="jpg" or getExt(objfileitem.name)="jpeg" Then 
	response.write     "<tr><td><img src="&objfileitem.name&">"&objfileitem.name&"</img></td>"   '文件名   
else
	response.write     "<tr><td><a     href="&objfileitem.name&">"&objfileitem.name&"</a></td>"   '文件名   
end if
response.write     "<td>"&objfileitem.type&"</td>"             '类型   
response.write     "<td>"&objfileitem.size&"k</td>"           '文件大小   
response.write     "<td>"&objfileitem.datelastmodified&"</td></tr>"           '更新日期   
next   
response.write     "</table>"   

Function getExt(str) 
getExt = Lcase(Right(str,Len(str)-InstrRev(str,"."))) 
End Function 

%>