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
Printable View
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
Look at DirListBox
yea, i can do that, but i want to be able to write the directory listing to a file
huh? Just go item by item through the list member of the DirListBox and write each out to the open file.
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