码迷,mamicode.com
首页 > 其他好文 > 详细

文件遍历排序函数

时间:2014-05-12 14:54:44      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:style   class   c   ext   color   int   


<%

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 
%>


文件遍历排序函数,布布扣,bubuko.com

文件遍历排序函数

标签:style   class   c   ext   color   int   

原文地址:http://blog.csdn.net/u014739775/article/details/25462147

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!