文件,目录列表(ASP版本)
来源:互联网 发布:linux 磁盘挂载重启 编辑:程序博客网 时间:2024/04/30 14:08
<!---将此文件存为folder_list.asp看看效果就知道了加上权限就可以方便自己了,--->
<%
'const_domain_name为域名最后不要加斜杠
const const_domain_name="http://localhost"
%>
<style>
b,img,a{font-size:9pt;line-height:150%;text-decoration:none;color:#0000cc;}
span{font-size:12pt;}
</style>
<%
'------------------------------------------------显示当前目录下的子目录和文件
sub list
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(server.MapPath("."))
set fs=f.SubFolders
Set fc =f.Files
For Each fss in fs
dim folder_name
folder_name=fss.name
%>
<a href="folder_list.asp?act=list_cur&cur_path=<%=fss%>"><span style="font-family:wingdings">0</span><%=folder_name%></a><br>
<%
Next
%>
<%
For Each f1 in fc
dim filename
filename=f1.name
%>
<a href="<%=p2v_path(f1)%>"><span style="font-family:wingdings 2">/</span><%=filename%></a><br>
<%
Next
set fso=nothing
end sub
%>
<%
'------------------------------------------------显示指定路径下的目录和文件
sub list_cur
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(request("cur_path"))
set fs=f.SubFolders
Set fc =f.Files
For Each fss in fs
dim folder_name
folder_name=fss.name
%>
<a href="folder_list.asp?act=list_cur&cur_path=<%=fss%>"><span style="font-family:wingdings">0</span><%=folder_name%></a><br>
<%
Next
%>
<%
For Each f1 in fc
dim filename
filename=f1.name
%>
<a href="<%=p2v_path(f1)%>"><span style="font-family:wingdings 2">/</span><%=filename%></a><br>
<%
Next
set fso=nothing
end sub
%>
<%
'------------------------------------------------显示上级目录的子目录和子文件
sub list_parent
on error resume next
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(display_cur_path)
set fs=f.SubFolders
Set fc =f.Files
For Each fss in fs
dim folder_name
folder_name=fss.name
%>
<a href="folder_list.asp?act=list_cur&cur_path=<%=fss%>"><span style="font-family:wingdings">0</span><%=folder_name%></a><br>
<%
Next
%>
<%
For Each f1 in fc
dim filename
filename=f1.name
%>
<a href="<%=p2v_path(f1)%>"><span style="font-family:wingdings 2">/</span><%=filename%></a><br>
<%
Next
set fso=nothing
on error goto 0
end sub
'---------------------------------------------得到上级目录的路径
function get_parent_folder()
on error resume next
str=display_cur_path
str_find="/"
str_int=InStrRev (str,str_find)-1 '得到上一级目录的路径
get_parent_folder=mid(str,1,str_int)
err.clear
end function
'-----------------------------------------------将文件路径转为www发布的路径这样就可以下载了
function p2v_path(p_path)
'p_path为硬盘上的物理路径
dim host
host=lcase(server.MapPath("/"))
p_path=lcase(p_path)
p2v_path=replace(p_path,host,const_domain_name)
end function
'-----------------------------------------------显示当前所在的路径
function display_cur_path()
cur_path=request("cur_path")
if cur_path="" then
display_cur_path=server.MapPath(".")
else
display_cur_path=cur_path
end if
set fso=nothing
end function
sub main
%>
<a href="folder_list.asp?act=list_parent&cur_path=<%=get_parent_folder%>">向上</a> <b><a href="javascript:void(null)"><%=display_cur_path%></a></B><p>
<%
select case request("act")
case "list_parent"
list_parent
case "list_cur"
list_cur
case else
list
end select
end sub
main
%>
- 文件,目录列表(ASP版本)
- 读目录的文件列表
- 文件目录导出成列表
- 生成当前目录文件列表
- tomcat显示目录文件列表
- 自动生成文件目录列表
- ASP+MSSQL系列注射教程之三。暴目录及文件列表。
- 用ASP,FSO显示当前根目录下所有文件,目录列表的方法
- 用ASP,FSO显示当前根目录下所有文件,目录列表的方法
- svn版本管理文件列表
- Android系统文件目录文件列表
- Tomcat显示文件目录&文件列表
- asp列出文件夹目录及文件目录
- C++获取目录下的文件列表
- 读取目录下的文件列表
- PHP 访问目录显示文件列表
- 列出与禁止文件目录列表
- 获取ftp服务器文件和目录列表
- 使用C#+ASP.NET来进行RSA(非对称)加密.
- 在ASP.NET中使用WINDOWS身份假冒
- 使用ASP.NET来管理IIS
- Director中读写外部文本的技术
- 管理IIS(创建站点和虚拟目录)的ASP版本
- 文件,目录列表(ASP版本)
- Project Diary - 1
- 庆祝blog开通!
- 酒店管理(链表和文件操作)
- 几何中点(三维向量)、线、面的类
- 我的第一篇blog^O^
- 呵呵!好像可以用了。
- Congratulations!
- 庆祝Blog开通&端午节有粽子吃!^_*