欢迎来到代码驿站!

ASP代码

当前位置:首页 > 软件编程 > ASP代码

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

时间:2021-04-22 09:13:58|栏目:ASP代码|点击:
******************************

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编程入门进阶(十二):ASP技巧累加(一)

栏    目:ASP代码

下一篇:如何使用Administrators组用户运行ASP程序

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

本文地址:http://www.codeinn.net/misctech/106572.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有