![]() |
Network folder list
I need some help with being able to programatically create a list of
all folders I have access to on a server. I am wanting to get this list of directories (not files) using UNC paths. I have found all sorts of topics on file searching and so no but not just for directories. I want to be able to list all directories & sub-directories under \\Myserver\Vol1\ Can someone point me in the right direction? |
Network folder list
You may want to give my free Excel add-in "List Files" a try.
It will list files and folders or just folders. I've never tried it for folders on a server, so no guarantees. Download from... http://www.realezsites.com/bus/primitivesoftware If you want to build your own, the Scripting Runtime, FileSystemObject may be the way to go. Help file can be downloaded from... http://msdn.microsoft.com/library/de...ist/webdev.asp Jim Cone San Francisco, USA wrote in message I need some help with being able to programatically create a list of all folders I have access to on a server. I am wanting to get this list of directories (not files) using UNC paths. I have found all sorts of topics on file searching and so no but not just for directories. I want to be able to list all directories & sub-directories under \\Myserver\Vol1\ Can someone point me in the right direction? |
Network folder list
This function will enumerate all folders & subfolders beneath a given path,
UNC or mapped: Function ListFolders(ByVal MyFolder As String) Dim SubFold As Object, fso As Object, lst As String Set fso = CreateObject("Scripting.FileSystemObject").GetFold er(MyFolder) For Each SubFold In fso.SubFolders ListFolders = ListFolders & "," & SubFold.Path Select Case SubFold.Type Case "File Folder" lst = ListFolders(SubFold.Path) If 0 < Len(lst) Then ListFolders = ListFolders & "," & lst End Select Next ListFolders = Mid(ListFolders, 2) Set fso = Nothing Set SubFold = Nothing End Function NOTE: 1. This function is recursive: test it with a folder that is not too deep. 2. The function returns a comma delimited string. 3. The function does not check whether the argument you supply exists! If this is an issue, use the PathFileExists API call to ensure that it does exist. USAGE: xx = ListFolders("\\MyServer\MyPath") or xx = ListFolders("c:\Winnt\System32") " wrote: I need some help with being able to programatically create a list of all folders I have access to on a server. I am wanting to get this list of directories (not files) using UNC paths. I have found all sorts of topics on file searching and so no but not just for directories. I want to be able to list all directories & sub-directories under \\Myserver\Vol1\ Can someone point me in the right direction? |
All times are GMT +1. The time now is 02:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com