Set oFso = CreateObject("Scripting.FileSystemObject")
dim a
a=""
msgbox "点击确定开始扫描c盘,这些需要几分钟的时间"
treeIt("c:\")
set f=ofso.opentextfile("jl.txt",2,true)
f.write a
f.close
msgbox "OK"
Function TreeIt(sPath)
on error resume next
Set oFso = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFso.GetFolder(sPath)
Set oSubFolders = oFolder.Subfolders
Set oFiles = oFolder.Files
For Each oFile In oFiles
a=a & ofile.path & vbcrlf
Next
For Each oSubFolder In oSubFolders
TreeIt(oSubFolder.Path)
Next
End Function
温馨提示:答案为网友推荐,仅供参考