******************************
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
1/2 1