源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2022-12-05 05:04 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:读取目录下的所有文件(包括子目录下的所有文件)
****************************** 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)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部