DirScan




Private Sub Command1_Click()
Screen.MousePointer = vbHourglass
'start at root directory

Dir1.Path = "c:\"
'clear list box to prevent duplicate entries

List1.Clear
DirectoryScan
Screen.MousePointer = vbDefault
End Sub

Private Sub DirectoryScan()
Dim intTotalFolders As Integer
Dim lngCounter As Long
'

'use this error handler in case you do not have

'access to enter a directory

'

On Error Resume Next
intTotalFolders = Dir1.ListCount

If intTotalFolders > 0 Then
For lngCounter = 0 To intTotalFolders - 1
Dir1.Path = Dir1.List(lngCounter)
Form1.Refresh
DirectoryScan
Next
End If

List1.AddItem Dir1.Path
Dir1.Path = Dir1.List(-2)
Dir1.Refresh
End Sub
Assumes:
Create a new project with a list box, directory list box
and a command button on the form.










( dirscan.html )- by Paolo Puglisi - Modifica del 17/12/2023