当前位置: 首页 > 图文教程 > 网络编程 > ASP > 文件遍历排序函数

ASP
ASP,FSO遍历目录及目录下文件
fso的一些特殊功能
利用FSO取得图像文件信息
二级域名原理以及程序
用FSO获得图片文件的信息(大小,宽,高)
IE功能汇总
ASP常用的函数
Oracle常用功能集锦
一个简单的HTML病毒分析
如何使用FSO搜索硬盘文件
使用函数自动生成n层目录
FSO操作示例(给初学者)
同文件夹内文本搜索器(vbs)
一个实用的FSO-实时统计在线人数
如何获知页面上的图象的实际尺寸?
在ASP中使用FSO组件生成HTML页面
用asp实现的代码批量修改程序,fso相关
fso实例
硬盘文件搜索代码(ASP类)
遍历目录以及目录下文件的函数

ASP 中的 文件遍历排序函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 41 ::
收藏到网摘: n/a

<%
function bianli(path)
'initiate
path = server.mappath(path)
set fso=server.CreateObject("scripting.filesystemobject")
set objFolder=fso.GetFolder(path)
set objfiles = objfolder.files
'把文件名及文件路经存入theFiles数组
int slot = 0
Dim theFiles()
redim theFiles(50)
for each objFile in objFiles
filename = objFile.name
filePath = split(objFile.path,"docs\")
thepath1 = "./docs/"
thepath = thepath1 & filepath(1)
theFiles(slot) = filename&"**"&thepath
slot = slot + 1
if slot > UBound(theFiles) then
ReDim Preserve theFiles(Slot+20)
end if
next
ReDim Preserve theFiles(slot)

'冒泡排序
for i = 0 to UBound(theFiles)-2
for j = i+1 to UBound(theFiles)-1
if strComp(theFiles(i),theFiles(j)) = 1 then
tmp = theFiles(i)
theFiles(i) = theFiles(j)
theFiles(j) = tmp
end if
next
next
'输出
for i = 0 to UBound(theFiles)-1
para = theFiles(i)
filename = split(para,"**",-1,1)(0)
filepath = split(para,"**",-1,1)(1)
%>
<p align = "left">
---<img src='../../images/arrow_orange.gif' width='14' height='11'>
<a href='<%=filepath%>'><span class="activelink_yellow"><%=filename%></span></a>
</p>
<%
next
end function
%>