如何用vb遍历一个文件夹下的所有文件包括自文件夹

2024-11-18 06:32:13
推荐回答(1个)
回答1:

Dim fso As Object, fd As Object, f As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set fd = fso.GetFolder("要处理文件夹全路径名写")
For Each f In fd.Files
'遍历每文件进行操作
'其f.Name文件名f.Path文件路径
'f.Size文件f.Type文件类型等等
'防止卡顿循环用面行:
'DoEvents
Next
Set fd = Nothing
Set fso = Nothing
-