手机
当前位置:查字典教程网 >编程开发 >ASP教程 >文件遍历排序函数
文件遍历排序函数
摘要:UBound(theFiles)thenReDimPreservetheFiles(Slot+20)endifnextReDimPreser...

<%

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

%>

【文件遍历排序函数】相关文章:

ASP代码实现301重定向及带参数的方法

asp中的Rnd 函数

ASP常用函数:IIF()

用ASP打开远端MDB文件的方法

通过数组给您的文件排序

收集asp的常用函数

文件的读出 编辑 管理

遍历目录以及目录下文件的函数

asp 中常用的文件处理函数

一段在asp中加密与解密对应的函数

精品推荐
分类导航