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

ASP
查询翻页优化
强制刷新和判断文件地址
asp缓存类
Byval与Byref的区别
全面认识ASP注入技巧
ubbcode函数
newasp中下载类
[ASP]精华代码
由给定的字符串生成关键字
经验几则
转换中文为unicode 转换unicode到正常文本
在ASP应用程序中限制重复提交同一表单
ASP 程序实现自动升级功能
在ASP编程中使用数组
asp组件编写准备工作
利用AdoDb.Stream对象来读取UTF-8格式的文本文件
把字符串转换成数据库SQL语句格式
access中链接表的问题
access数据库的一些少用操作,ASP,创建数据库文件,创建表,创建字段,ADOX
Asp Access 创建静态文件/HTML

ASP 中的 文件遍历排序函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 42 ::
收藏到网摘: 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
%>