文件遍历排序函数
2023-06-13 09:13:46 时间
<%
functionbianli(path)
"initiate
path=server.mappath(path)
setfso=server.CreateObject("scripting.filesystemobject")
setobjFolder=fso.GetFolder(path)
setobjfiles=objfolder.files
"把文件名及文件路经存入theFiles数组
intslot=0
DimtheFiles()
redimtheFiles(50)
foreachobjFileinobjFiles
filename=objFile.name
filePath=split(objFile.path,"docs\")
thepath1="./docs/"
thepath=thepath1&filepath(1)
theFiles(slot)=filename&"**"&thepath
slot=slot+1
ifslot>UBound(theFiles)then
ReDimPreservetheFiles(Slot+20)
endif
next
ReDimPreservetheFiles(slot)
"冒泡排序
fori=0toUBound(theFiles)-2
forj=i+1toUBound(theFiles)-1
ifstrComp(theFiles(i),theFiles(j))=1then
tmp=theFiles(i)
theFiles(i)=theFiles(j)
theFiles(j)=tmp
endif
next
next
"输出
fori=0toUBound(theFiles)-1
para=theFiles(i)
filename=split(para,"**",-1,1)(0)
filepath=split(para,"**",-1,1)(1)
%>
<palign="left">
---<imgsrc="../../images/arrow_orange.gif"width="14"height="11">
<ahref="<%=filepath%>"><spanclass="activelink_yellow"><%=filename%></span></a>
</p>
<%
next
endfunction
%>
functionbianli(path)
"initiate
path=server.mappath(path)
setfso=server.CreateObject("scripting.filesystemobject")
setobjFolder=fso.GetFolder(path)
setobjfiles=objfolder.files
"把文件名及文件路经存入theFiles数组
intslot=0
DimtheFiles()
redimtheFiles(50)
foreachobjFileinobjFiles
filename=objFile.name
filePath=split(objFile.path,"docs\")
thepath1="./docs/"
thepath=thepath1&filepath(1)
theFiles(slot)=filename&"**"&thepath
slot=slot+1
ifslot>UBound(theFiles)then
ReDimPreservetheFiles(Slot+20)
endif
next
ReDimPreservetheFiles(slot)
"冒泡排序
fori=0toUBound(theFiles)-2
forj=i+1toUBound(theFiles)-1
ifstrComp(theFiles(i),theFiles(j))=1then
tmp=theFiles(i)
theFiles(i)=theFiles(j)
theFiles(j)=tmp
endif
next
next
"输出
fori=0toUBound(theFiles)-1
para=theFiles(i)
filename=split(para,"**",-1,1)(0)
filepath=split(para,"**",-1,1)(1)
%>
<palign="left">
---<imgsrc="../../images/arrow_orange.gif"width="14"height="11">
<ahref="<%=filepath%>"><spanclass="activelink_yellow"><%=filename%></span></a>
</p>
<%
next
endfunction
%>
相关文章
- dex文件打开
- Python遍历(查找)指定文件
- OpenOffice3.0以服务方式运行在Windows平台(文件转换服务器解决方案)
- fscanf读取一行字符串-语言文件操作
- C/C++ 递归遍历文件并计算MD5
- input:文件选择和隐藏
- 两台Linux系统服务器之间传输文件教程
- Python指定文件备份工具详解编程语言
- Linux查看.a文件:一步简单解决方案(linux查看.a文件)
- JSP JSTL <x:forEach>标签:遍历XML文件
- Linux系统文件数量之旅(linux打开的文件数量)
- Linux命令掌握:编辑文件.(编辑文件linux命令)
- 命令使用Linux zmore命令进行文件查看(linuxzmore)
- Linux命令:遍历目录文件(linux遍历目录文件)
- 如何在Linux系统中遍历文件并查看其大小?(linux遍历文件大小)
- 解压Linux下Gzip文件解压的技巧(linux下 gzip)
- Linux: 文件合并方便利用命令行实现(linux文件合并命令)
- ASP,FSO遍历目录及目录下文件
- 遍历目录以及目录下文件的函数
- js+FSO遍历文件夹下文件并显示
- textarea的value是html文件源代码,存成html文件的代码
- 遍历指定目录下的所有目录和文件的php代码
- 基于将Android工程做成jar包和资源文件的解决方法
- 使用PHP遍历文件目录与清除目录中文件的实现详解
- python中遍历文件的3个方法
- PHP遍历文件夹与文件类及处理类用法实例