asp遍历指定目录下的文件

时间:2009-03-26    点击:1483   

<%
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 & filename'filepath(0)
   'thepath="ff"
   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='anieye01.ico' width='14' height='11'>
    <a href='<%=filepath%>'><span class="activelink_yellow"><%=filename%></span></a>
    </p>
 <%
  next
 end function
 %>
<h3>遍历指定目录下的文件</h3>
<hr>
 <%
 call bianli("114")
%>

asp读取驱动器信息
asp浏览文件夹下所有文件信息
asp文件夹的复制
asp文件夹的获取
asp文件夹的移动
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 All Rights Reserved