asp函数遍历文件夹代码

来源:cloudgamer 时间:2010-06-21 10:38:00 

使用fso对象遍历指定文件夹函数:

'遍历文件夹
sub ListFolderContents(path)
    dim fs, folder, file, item, url
    set fs = CreateObject("Scripting.FileSystemObject")
    set folder = fs.GetFolder(path)
    
    Response.Write("<li><b>" & folder.Name & "</b> - " & folder.Files.Count & " files, " & folder.SubFolders.Count & " directories." & vbCrLf & "<ul>" & vbCrLf)
    
    
    for each item in folder.SubFolders
        ListFolderContents(item.Path)
    next
    
    for each item in folder.Files
        Response.Write("<li><a href=""" & MapURL(item.path) & """ target='_blank'>" & item.Name & "</a> - " & item.path & "</li>" & vbCrLf)
    next
    
    Response.Write("</ul>" & vbCrLf)
    
    Response.Write("</li>" & vbCrLf)
end sub
function MapURL(path)
    MapURL = Replace(Right(path, Len(path) - Len(Server.MapPath("/"))), "\", "/")
end function
ListFolderContents("D:\aspxhome.com\")

标签:文件夹,asp,函数
0
投稿

猜你喜欢

  • python实现解数独程序代码

    2021-05-16 18:39:43
  • python使用python-pptx删除ppt某页实例

    2022-10-23 16:19:59
  • python数据结构之链表的实例讲解

    2021-09-24 17:58:46
  • python中reduce()函数的使用方法示例

    2021-08-09 12:32:53
  • Python使用itchat 功能分析微信好友性别和位置

    2023-09-24 15:57:12
  • Python3中使用PyMongo的方法详解

    2023-08-19 16:00:58
  • 淘宝CSS框架研究(1):Reset CSS(八卦篇)

    2009-03-31 12:58:00
  • pycharm重命名文件的方法步骤

    2021-10-21 23:16:42
  • Mootools 1.2教程(9)——输入过滤第二部分(字符串)

    2008-12-01 12:25:00
  • MySQL笔记之触发器的应用

    2024-01-18 17:23:32
  • Python中Numpy的深拷贝和浅拷贝

    2021-10-04 21:08:43
  • MySQL自定义函数简单用法示例

    2024-01-20 12:47:17
  • mysql 主从服务器的简单配置

    2009-09-06 12:06:00
  • 浅析python参数的知识点

    2022-12-16 01:39:32
  • volatile保证可见性及重排序方法

    2022-07-22 03:14:59
  • php实现将数组或对象写入到文件的方法小结【三种方法】

    2023-11-19 05:08:04
  • asp连接SQL和Access数据代码(asp里的随机函数)

    2013-06-01 20:26:06
  • python绘制字符画视频的示例代码

    2023-11-09 16:21:46
  • 利用Python如何实现K-means聚类算法

    2023-09-16 09:17:38
  • vuex实现购物车功能

    2024-05-08 10:43:27
  • asp之家 网络编程 m.aspxhome.com