显示文件夹的树形目录
发布时间:2020-12-17 07:58:43 所属栏目:百科 来源:网络整理
导读:今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 ''IndexScripts()'''Written by Keep Bertha Surfin Heavy Industries,'a division of Keep Bertha Surfin Electrical Concern'Version 1.0 - [email?
以下代码由PHP站长网 52php.cn收集自互联网 现在PHP站长网小编把它分享给大家,仅供参考 ' ' IndexScripts() ' ' ' Written by Keep Bertha Surfin Heavy Industries,' a division of Keep Bertha Surfin Electrical Concern ' Version 1.0 - [email?protected] ' ' First thing,check the argument list for a directory. ' If they didn't specify one,use the current directory. option explicit ' Run the function :) call IndexScripts sub IndexScripts() dim fso set fso = createobject("scripting.filesystemobject") dim loc if WScript.Arguments.Count = 0 then loc = fso.GetAbsolutePathName(".") else loc = WScript.Arguments(0) end if GetWorkingFolder loc,1,"|" set fso = nothing End Sub ' called recursively to get a folder to work in function GetWorkingFolder(foldspec,foldcount,firsttime,spacer) dim fso Set fso = CreateObject("Scripting.FileSystemObject") dim fold set fold = fso.GetFolder(foldspec) dim foldcol set foldcol = fold.SubFolders if firsttime = 1 then wscript.echo fold.name spacer = "" foldcount = foldcol.count firsttime = 0 end if dim remaincount remaincount = foldcol.count dim sf for each sf in foldcol spacer = spacer + space(3) + "|" wscript.echo spacer + "-- " + sf.name ' If you wanted to show the number of bytes,use this line instead of above 'wscript.echo spacer + "-- " + sf.name + " (uses " + cstr(FormatNumber(sf.size)) + " bytes)" if remaincount = 1 then spacer = left(spacer,len(spacer) - 1) spacer = spacer + " " end if ' ' if you want to do something more useful,put that function call,or just ' insert the code,here. ' remaincount = GetWorkingFolder (foldspec +""+sf.name,remaincount,spacer) next if len(spacer) > 3 then spacer = left(spacer,len(spacer) - 4) end if set fso = nothing GetWorkingFolder = foldcount - 1 end function 以上内容由PHP站长网【52php.cn】收集整理供大家参考研究 如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |