作家
登录

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

作者: 来源:www.28hudong.com 2013-03-30 08:54:27 阅读 我要评论

****************************** 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 ******************************

  推荐阅读

  在ASP中连接MySQL数据库,最好的通过ODBC方法

折腾了一阵,总算把ASP和MySQL连接完成了,有感,特写此文与大家一同分享。  查了很多资料,ASP和MySQL连接目前有两种办法:一个是使用组件,比较有名是MySQLX,可惜要99美元。二就是使用MyODBC 来连接,下面我们>>>详细阅读


本文标题:读取目录下的所有文件(包括子目录下的所有文件)

地址:http://www.17bianji.com/kaifa2/ASP/32955.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)