list of folders and subfolder.; quit simple ..but.;

F

fth

hi to all,

I'm looking for somethings looks like simple but..
i want to create a list of all subfolder of a certain folder.
No need to list file or others stuff..just get a list of folder and sub.

could you please help me?

many thanks in advance,

Frederic
 
F

fth

Hi Gary,

I get your code and try it but i don't have the expected result..

I have orror message like:

wrong number of arguments..

a idea?

best regards and many thanks for your help,

Frederic
 
F

fth

Hi,
Thanks for you help .;and you XLA

unfortunatly, i can't use it
it seems that my tree is too big ..

may be a idea to solve that?

many thanks in advance,

Frederic
 
J

Jim Cone

Sub MakeFolderList()
Call ListSubFoldersInFolder("C:\Program Files")
End Sub
'---
Function ListSubFoldersInFolder(ByRef strPath As String)
'Jim Cone - Portland, Oregon USA - September 2008
Dim oFSO As Object
Dim oFolder As Object
Dim oSubFldr As Object
Dim N As Long
Application.ScreenUpdating = False
N = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(strPath)
Cells(N, 1).Value = oFolder.Path
N = N + 1

For Each oSubFldr In oFolder.Subfolders
Cells(N, 1).Value = oSubFldr.Name
N = N + 1
Call ListSubFolders(oSubFldr, N)
Next

Application.ScreenUpdating = True
Set oFSO = Nothing
Set oFolder = Nothing
End Function
'---
Function ListSubFolders(ByRef oParentFolder As Object, ByRef lngR As Long)
Dim oSubFolder As Object
For Each oSubFolder In oParentFolder.Subfolders
Cells(lngR, 2).Value = oSubFolder.Name
lngR = lngR + 1
ListSubFolders oSubFolder, lngR
Next 'oSubFolder
End Function
'---
Jim Cone
Portland, Oregon USA



"fth"
wrote in message
hi to all,
I'm looking for somethings looks like simple but..
i want to create a list of all subfolder of a certain folder.
No need to list file or others stuff..just get a list of folder and sub.

could you please help me?
many thanks in advance,
Frederic
 
F

fth

Jim,

Many thanks, it was exactely what I'm looking for.
I just have to modifysome tips (cell in one column, full path ..)

I make a test with a very very big tree and let you know the result.

This code is the first step on what I have to do.

The next step is to read all the security parameters for each folder (user
or groups - for each, what is the security..)

If you have a idea..

many thanks to you (and to the others who gave me some good tracks)

Frederic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top