欢迎光临
我们一直在努力

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

建站超值云服务器,限时71元/月

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

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

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

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 读取目录下的所有文件(包括子目录下的所有文件)
分享到: 更多 (0)