這篇文章將為大家詳細(xì)講解有關(guān)VBS如何遍歷文件或文件夾路徑輸入文件的所有絕對(duì)路徑,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
示例代碼如下:
Function listFilesPath(filepath) t1=Timer() Debug.WriteLine "****現(xiàn)在開(kāi)始執(zhí)行計(jì)數(shù),用時(shí):"+CStr(t1) Set fso=CreateObject("scripting.filesystemobject") Set myfolder=fso.GetFolder(filepath) If fso.FolderExists(filepath) then Set subcol=myfolder.SubFolders Set filescol=myfolder.Files For Each file In filescol Debug.WriteLine filepath+"\"+file.name Next If subcol.count>0 Then For Each folder In subcol 'Debug.WriteLine filepath+"\"+folder.Name listFilesPath(filepath+"\"+folder.Name) next End if Else Debug.WriteLine "沒(méi)有該文件系統(tǒng)" End if Set filescol=Nothing Set subcol=nothing Set fso=Nothing t2=Timer() Debug.WriteLine "****現(xiàn)在完成計(jì)數(shù),用時(shí):"+CStr(t2) Debug.WriteLine "整個(gè)操作過(guò)程用時(shí):"&CStr(t2-t1)&" 秒" End function
關(guān)于“VBS如何遍歷文件或文件夾路徑輸入文件的所有絕對(duì)路徑”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。