Results 1 to 5 of 5

Thread: dir structure

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    33
    How would i go about getting all the subdirectories within a specified directory e.g.

    parent - c:\
    sub c:\windows
    sub c:\program files
    .....etc.

    i just want a directory listing

    thanks in advance
    jeff

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Boulder, Colorado, USA
    Posts
    325
    Look at DirListBox
    -Shickadance

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    33
    yea, i can do that, but i want to be able to write the directory listing to a file

  4. #4
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Boulder, Colorado, USA
    Posts
    325
    huh? Just go item by item through the list member of the DirListBox and write each out to the open file.
    -Shickadance

  5. #5
    Junior Member
    Join Date
    Jan 2000
    Location
    MN, USA
    Posts
    25
    This is from the Visual Basic 5 help. It basically says that you can cycle through a directory by first having a full dir("C:\") and then having dir in a loop. I just figured it out a short while ago.

    MyPath = "c:\" ' Set the path.
    MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
    Do While MyName <> "" ' Start the loop.
    ' Ignore the current directory and the encompassing directory.
    If MyName <> "." And MyName <> ".." Then
    ' Use bitwise comparison to make sure MyName is a directory.

    If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
    Debug.Print MyName ' Display entry only if it
    End If ' it represents a directory.
    End If
    MyName = Dir ' Get next entry.
    Loop

    I hope this helps

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