加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

FSO 遍历文件夹和文件

发布时间:2020-12-16 22:55:47 所属栏目:大数据 来源:网络整理
导读:Attribute VB_Name = "遍历文件夹和文件" Option Explicit Public Sub 遍历文件夹和文件(sFolder As String) Dim fs As Object On Error Resume Next Set fs = CreateObject("Scripting.FileSystemObject") File_Folder_List (fs.GetFolder(sFolder)) Set fs

Attribute VB_Name = "遍历文件夹和文件"
Option Explicit

Public Sub 遍历文件夹和文件(sFolder As String)
Dim fs As Object
On Error Resume Next
Set fs = CreateObject("Scripting.FileSystemObject")
File_Folder_List (fs.GetFolder(sFolder))
Set fs = Nothing
End Sub

Private Sub File_Folder_List(df As Object)

'循环处理文件集合

Dim objFile As Object,objSubFolder As Object

'文件集合
For Each objFile In df.Files
'
'
'文件处理过程
'
'
Next objFile

Set objFile = Nothing

'文件夹集合
For Each objSubFolder In df.SubFolders

'
'
'文件夹处理过程
'
'

File_Folder_List objSubFolder '递归循环处理文件夹

Next objSubFolder

Set objSubFolder = NothingEnd Sub

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读