FindFileDrive




Private Sub Command1_Click()
'Clear lists

stijd = Time
List1.Clear
List2.Clear
'Set path to root directory

Dir1.Path = Left$(Drive1.Drive, 2) + "\"
File1.Path = Dir1.Path 'Set file path
'Add files in root directory to catalog

For t& = 0 To file1.ListCount - 1
If Right$(Dir1.Path, 1) <> "\" Then
list2.AddItem Dir1.Path + "\" + file1.List(t&)
Else
list2.AddItem Dir1.Path + file1.List(t&)
End If
Next
'Add initial subdirectories in root

For t& = 0 To Dir1.ListCount - 1
List1.AddItem Dir1.List(t&)
Next
If t& = 0 Then GoTo finishedpoint 'No subdirectories, we're done.
cnt& = 0 'Start with first directory in list
startpoint:
Dir1.Path = List1.List(cnt&)
File1.Path = Dir1.Path
'Add any subdirectories found

For t& = 0 To Dir1.ListCount - 1
List1.AddItem Dir1.List(t&)
Next
'Now add files found...

For t& = 0 To File1.ListCount - 1
List2.AddItem Dir1.Path + "\" + File1.List(t&)
Next
'Increment count

cnt& = cnt& + 1
If cnt& < List1.ListCount Then GoTo startpoint
finishedpoint:
label1.Caption = "Total:" + Str$(List2.ListCount)
etijd = Time
label2.Caption = "Time slipped away... Started at " & Format(stijd, "hh:mm:ss") & ". Ended after " & Format(stijd - etijd, "hh:mm:ss")
End Sub











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