VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Search Drive

by Joseph Ronie (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

Search Drive for files with a few lines o'code, Recursivly- Please VOTE!!!!

Assumes
Add: Commandbutton, dir list box, file list box, text1.text, label1, label3, listbox

Rate Search Drive

Private Sub Command1_Click()
 File1.Pattern = "*.exe"
 Label3.Caption = "Searching " & File1.Pattern
 Call search("C:\")
End Sub
Public Sub search(dr As String)
Dim lst(5000) As String
Dim lstcnt As Integer
Dir1.Path = dr
listcnt = 0
 Do While (Dir1.ListIndex < Dir1.ListCount - 1)
  Dir1.ListIndex = Dir1.ListIndex + 1
  listcnt = listcnt + 1
  lst(listcnt) = Dir1.List(Dir1.ListIndex)
 Loop
 For i = 1 To listcnt
  search (lst(i))
 Next i
  
  File1.Path = Dir1.List(Dir1.ListIndex)
  DoEvents
  
  Do While (File1.ListIndex < _   File1.ListCount - 1)
   File1.ListIndex = File1.ListIndex + 1
   List1.AddItem (Dir1.List _(Dir1.ListIndex) & "\" & File1.FileName)
   DoEvents
  Loop
End Sub

Download this snippet    Add to My Saved Code

Search Drive Comments

No comments have been posted about Search Drive. Why not be the first to post a comment about Search Drive.

Post your comment

Subject:
Message:
0/1000 characters