文件遍历排序函数
2006-10-28 00:00
2161 查看
<%
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
%>
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
%>
相关文章推荐
- 文件遍历排序函数
- php 遍历 excel文件。
- 递归遍历Linux下的目录文件源码实现
- 文件操作及字符串操作(二):遍历文件夹下的所有文件
- 使用glob方法遍历文件夹下所有文件
- 使用boost中的filesystem类库遍历某个目录所有的文件
- 遍历文件夹及其子文件夹下所有文件
- python学习笔记_文件遍历
- Java遍历文件夹,重命名文件,删除文件,复制文件等操作
- 遍历文件及目录
- VBS递归遍历文件和dictionary使用
- jsp遍历文件夹下的文件的代码
- Java遍历列出某一目录下的文件及文件夹,寻找某一指定文件
- 遍历文件下所有文件
- java 递归模式 遍历给定文件
- 递归遍历路径下所有文件算法
- VC++ 6.0 环境下遍历文件
- 第16课 Python循环体for遍历文件和元组
- java遍历文件夹中所有文件
- c++ 遍历目录下文件