473,394 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to write a program to search the computer for files.

Greetings unto thee.

I want to know how to write an application in vb.net that will search my
computer for files.

An example: Windows Media Player has an option to search your pc for media
files and import them to its media library.

I want to know how to do that (the searching part, not the importing)

Your assistance in this regrard will be utmost appreciated.
--
TTB
Nov 21 '05 #1
2 1676
It's simply a recursive procedure, starting at the root and recursing
through sub-directories - you can maintain a collection of "found" items as
you go....:

Public Sub Scan (ByVal theFoundItems as ArrayList, ByVal theRoot as String)

Scan_Aux ( theFoundItems, theRoot )

End Sub

Public Sub Scan_Aux ( ByVal theFoundItems As ArrayList, ByVal theRoot As
String)

' First recurse through to the leaves....

Dim theDirectories() As String = Directory.GetDirectories ( theRoot )

For Each theDirectory As String In theDirectories
Scan_Aux ( theFoundItems, theDirectory )
Next

' Now scan the files in the current directory for any that match...

Dim theFiles() As String = Directory.GetFiles ( theRoot )

For Each theFile As String In theFiles

If ....<the file matches our criteria> Then
theFoundItems.Add theFile
End If

Next

End Sub

"Treasure Baloyi" <Tr************@discussions.microsoft.com> wrote in
message news:48**********************************@microsof t.com...
Greetings unto thee.

I want to know how to write an application in vb.net that will search my
computer for files.

An example: Windows Media Player has an option to search your pc for media
files and import them to its media library.

I want to know how to do that (the searching part, not the importing)

Your assistance in this regrard will be utmost appreciated.
--
TTB

Nov 21 '05 #2
"Treasure Baloyi" <Tr************@discussions.microsoft.com> schrieb:
I want to know how to write an application in vb.net that will search my
computer for files.
[...]
I want to know how to do that (the searching part, not the importing)


<URL:http://dotnet.mvps.org/dotnet/samples/filesystem/FileSystemEnumerator.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Roy Riddex | last post by:
Hi I'm wanting to create a cd-rom which boots automatically when it's inserted into the computer. What I hope to achieve is for a VB6 program to run automatically when the cd boots up. Can this...
17
by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to...
2
by: JeremyH | last post by:
I'm trying to create a simple, synchronous TCP client program to receive requests and return data. My code very closely resembles the example code provided in the Help files, but I find that the...
2
by: HC | last post by:
Hello, Folks. I am not sure if this can be done (and a brief search of this group didn't yield any results that I thought would do the trick) but if it can be done it would make my life easier so...
4
by: georges the man | last post by:
hey guys, i ve been posting for the last week trying to understand some stuff about c and reading but unfortunaly i couldnt do this. i have to write the following code. this will be the last...
24
by: Bill | last post by:
Hello, I'm trying to output buffer content to a file. I either get an access violation error, or crazy looking output in the file depending on which method I use to write the file. Can anyone...
1
by: Raymond Du | last post by:
Hi, I try to use ASP.Net 2.0 FileUpload control to upload files. The page is working fine when I upload files and save them into my local computer, but fails when the files are to be saved to...
13
by: TSB | last post by:
Hi everyone, I think algorithm is very important for every computer language. But I don't know another important things. I am newbie to computer languages, so anyone can tell me what the most...
5
by: TC | last post by:
I use Visual Studio 2005 v8.0 on two different computers. On one, the "Find and Replace" dialog gives me the option to look in the "Entire Solution". On the other computer, the "Find and Replace"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.