动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
   Asp → 阅读文章

 读取目录下的所有文件(包括子目录下的所有文件)

作者来源: 
阅读 3257 人次 , 2000-10-3 

******************************

Many times we might need some part of code which will access all sub-folders of the server and also all
files within the sub-folder.
The following line of asp code will map to a specified folder and searches all the sub-folders
(Not recursively, code can be extended to do) and reads all files(basically text files) one by one.

You can specify any folder name, in the remarks given in the code (within " ")

'Create a File system Object
set FileSystem=server.CreateObject("scripting.filesystemobject")

dim dbconn

folderpath=server.MapPath("main Folder path" )
set sfolder=Filesystem.GetFolder(folderpath).SubFolders
for each FolderItem in sfolder
    set Files=FolderItem.Files
    for each FileItem in Files
        fname=server.MapPath( "main folder path" & FolderItem.Name & "\" & FileItem.Name
            set File=FileSystem.OpenTextFile(fname,1,false)
            while File.AtEndofStream <> True
                record=split(File.Readline,"~")
            wend
            File.close
            FileSystem.DeleteFile(fname)
    next        
next    


******************************  
 
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:在WAP网站上建立反馈表单
· 下一篇:把句子的第一个字母转化为大写
· ASP进阶之文章在线管理更新(三)
· 二十八条改善 ASP 性能和外观的技巧(22-28)
· 一个通用的保护ASP系统的方法
· asp编程实例:用ASP实现对MP3曲目信息的操作
· 检查字符串strSource是否为big或big5码


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077