Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HyperLink to a folder on other drive on the same network (LAN) | Excel Worksheet Functions | |||
Folder Network drive | Excel Discussion (Misc queries) | |||
SetUp Templates in Network Folder | Setting up and Configuration of Excel | |||
Outlook attachment to network folder | Excel Discussion (Misc queries) | |||
change curdir to a folder on a network | Excel Programming |