排序函数:文件遍历排序函数



<%

function bianli(path)

\'initiate
path = server.mappath(path)
fso=server.CreateObject(\"scripting.filesystemobject\")
objFolder=fso.GetFolder(path)
objfiles = objfolder.files

\'把文件名及文件路经存入theFiles
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
slot > UBound(theFiles) then
ReDim Preserve theFiles(Slot+20)
end
next
ReDim Preserve theFiles(slot)


\'冒泡排序
for i = 0 to UBound(theFiles)-2
for j = i+1 to UBound(theFiles)-1
strComp(theFiles(i),theFiles(j)) = 1 then
tmp = theFiles(i)
theFiles(i) = theFiles(j)
theFiles(j) = tmp
end
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=\"http://127.0.0.1/Files/BeyondPic/2007-4/19/0741912542640368.g\" width=\'14\' height=\'11\'>
<a href=\'<%=filepath%>\'><span =\"activelink_yellow\"><%=filename%></span></a>
</p>
<%
next
end function
%>

Tags:  matlab排序函数 遍历文件夹 excel排序函数 排序函数

延伸阅读

最新评论

发表评论