|
|
Question : vbscript to list folder names
|
|
hello experts, looking for a script htat will list all folders in a directory... example \\server\users. so i would like all the folders names withing the users directory and list that to notepad or excel. thanks in advance.
|
Answer : vbscript to list folder names
|
|
Save as FolderScan.vbs...this is a recursive script, so it'll show the entire tree...
'FolderScan.vbs Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject") Dim objOutput: Set objOutput = objFSO.CreateTextFile("C:\Folders.txt")
fld="C:\ParentPath\" EnumFolders (objFSO.GetFolder(fld))
objOutput.Close Set objOutput=Nothing Set objFSO = Nothing wscript.quit
Sub EnumFolders(objFld) objOutput.WriteLine objFld.Path For Each fld In objFld.SubFolders EnumFolders (objFSO.GetFolder(fld)) Next End Sub
|
|
|
|