Results 1 to 4 of 4

Thread: [RESOLVED] List all folders from a given directory

  1. #1

    Thread Starter
    Hyperactive Member RS_Arm's Avatar
    Join Date
    Mar 2007
    Location
    Planet Earth
    Posts
    282

    Resolved [RESOLVED] List all folders from a given directory

    Hello once again

    I want to list all folders from a given directory. I've done this code but it only lists in one level and I want to list all levels.
    Can you guys give help to make it work?

    VB Code:
    1. Public Sub ListDir(path As String)
    2. Dim NameFolder As String
    3.  
    4. NameFolder = Dir(path, vbDirectory)
    5. Do While NameFolder <> ""
    6.     If NameFolder <> "." And NameFolder <> ".." Then
    7.         If (GetAttr(path & NameFolder) And vbDirectory) = vbDirectory Then
    8.             MainForm.MSHFlexGrid1.AddItem (path & NameFolder & "\")
    9.            
    10.         End If
    11.     End If
    12.     NameFolder = Dir
    13. Loop
    14.  
    15. End Sub

    Thank you

  2. #2

  3. #3

    Thread Starter
    Hyperactive Member RS_Arm's Avatar
    Join Date
    Mar 2007
    Location
    Planet Earth
    Posts
    282

    Re: List all folders from a given directory

    It is exactly what I wanted.
    Thank you very much.

  4. #4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width