heres something: VB projects - Recursive file search by extension
Basically how would you search for a file on your C drive.
All i need is a listbox with the file path for each file found.
Btw i need a fast method as way.
Last edited by ppl2pass; 05-18-2010 at 10:13 PM.
heres something: VB projects - Recursive file search by extension
The following code will search according to the pattern given. In this case .txt files:
[php] Dim searchAll As String = "*.*"
Dim searchSpecific As String = "*.txt"
For Each drive As DriveInfo In My.Computer.FileSystem.Drives
Try
For Each File As String In My.Computer.FileSystem.GetFiles(drive.Name, FileIO.SearchOption.SearchAllSubDirectories, searchSpecific )
Listbox1.Items.Add (File)
Next
Catch ex As Exception
'In case if a file's access is denied !!
Continue For
End Try
Next[/php]
Hope this helps !!
Last edited by Hassan; 05-18-2010 at 11:01 PM.
Hell_Demon (05-19-2010),ppl2pass (05-19-2010)
what if i want to search for txt file called database?
[php] Dim searchAll As String = "*.*"
Dim searchSpecific As String = "*.txt"
For Each drive As DriveInfo In My.Computer.FileSystem.Drives
Try
For Each File As String In My.Computer.FileSystem.GetFiles(drive.Name, FileIO.SearchOption.SearchAllSubDirectories, searchSpecific )
If system.io.path.getfilenamewithoutextension(File)=" database" Then
Listbox1.Items.Add (File)
End If
Next
Catch ex As Exception
'In case if a file's access is denied !!
Continue For
End Try
Next [/php]
ppl2pass (05-19-2010)
it doesnt work for me.
is the file name database.txt? if not then thats not gonna work ;P
Ah we-a blaze the fyah, make it bun dem!
Lolland (05-21-2010)