⽤递归的话思路很简单,
第⼆部分利⽤递归传⼊⼦⽂件夹內的路径
Function get_folder_file(pth)
'Dim fs As New FileSystemObject
吕梁旅游Set fso = CreateObject("Scripting.FileSystemObject").GetFolder(pth)
For Each File In fso.Files '第⼀部分
last_row = Range("a65536").End(xlUp).Row + 1
Range("a" & last_row) = fso.Path
Range("b" & last_row) = File.Name
DoEvents
王浩信蔡思贝幼儿教师格言Next
For Each Folder In fso.SubFolders '第⼆部分
Call get_folder_file(Folder.Path)
Next
武魂玩什么职业好鲍春来袁惟仁Set fso = Nothing
火影之地狱归来End Sub
Sub test()
pth = "F:\PYTHON2018\PYTHON2018\python3全栈3期\⽼男孩三期 Python全栈104天⽆密码"
Call get_folder_file(pth)
End Sub
发布评论