473,385 Members | 1,342 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,385 software developers and data experts.

Search for Directories/files/Folders

Thank you in advance for any and all assistance. I'm looking for a way to
programmatically scan all installed drives for programs that are installed.
Can someone point me to code to look for say, "keywords" on the installed
drives etc?

--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.
Oct 10 '06 #1
5 1438
Here's a console app I just threw together that will run through and
list all exes that the program has access to. You should be able to
modify it to do what you need. Let me know if you need more help.

Thanks,

Seth Rowe
Module Module1

Sub Main()
ListAllExes("C:/")
Console.WriteLine("done")
Console.Read()
End Sub

Private Sub ListAllExes(ByVal path As String)
Try
' Change the "*.exe" to your search condition
Dim filenames() As String =
System.IO.Directory.GetFiles(path, "*.exe")
For i As Int16 = 0 To filenames.Length - 1
Console.WriteLine(filenames(i))
Next
Dim directories() As String =
System.IO.Directory.GetDirectories(path)
For i As Int16 = 0 To directories.Length - 1
ListAllExes(directories(i))
Next
Catch ex As Exception
' do nothing
End Try
End Sub

End Module
eSolTec wrote:
Thank you in advance for any and all assistance. I'm looking for a way to
programmatically scan all installed drives for programs that are installed.
Can someone point me to code to look for say, "keywords" on the installed
drives etc?

--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.
Oct 10 '06 #2
Seth,

Thank you for the demo console app. I'm looking to find particular programs
installed. Do you think I can modify this to find say all "symantec" programs
or "mcafee" ?
--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.
"rowe_newsgroups" wrote:
Here's a console app I just threw together that will run through and
list all exes that the program has access to. You should be able to
modify it to do what you need. Let me know if you need more help.

Thanks,

Seth Rowe
Module Module1

Sub Main()
ListAllExes("C:/")
Console.WriteLine("done")
Console.Read()
End Sub

Private Sub ListAllExes(ByVal path As String)
Try
' Change the "*.exe" to your search condition
Dim filenames() As String =
System.IO.Directory.GetFiles(path, "*.exe")
For i As Int16 = 0 To filenames.Length - 1
Console.WriteLine(filenames(i))
Next
Dim directories() As String =
System.IO.Directory.GetDirectories(path)
For i As Int16 = 0 To directories.Length - 1
ListAllExes(directories(i))
Next
Catch ex As Exception
' do nothing
End Try
End Sub

End Module
eSolTec wrote:
Thank you in advance for any and all assistance. I'm looking for a way to
programmatically scan all installed drives for programs that are installed.
Can someone point me to code to look for say, "keywords" on the installed
drives etc?

--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.

Oct 10 '06 #3
If they use a certain naming convention you could just search for that.

Thanks,

Seth Rowe
eSolTec, Inc. 501(c)(3) <esol...@noemail.nospamwrote:
Seth,

Thank you for the demo console app. I'm looking to find particular programs
installed. Do you think I can modify this to find say all "symantec" programs
or "mcafee" ?
--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.
"rowe_newsgroups" wrote:
Here's a console app I just threw together that will run through and
list all exes that the program has access to. You should be able to
modify it to do what you need. Let me know if you need more help.

Thanks,

Seth Rowe
Module Module1

Sub Main()
ListAllExes("C:/")
Console.WriteLine("done")
Console.Read()
End Sub

Private Sub ListAllExes(ByVal path As String)
Try
' Change the "*.exe" to your search condition
Dim filenames() As String =
System.IO.Directory.GetFiles(path, "*.exe")
For i As Int16 = 0 To filenames.Length - 1
Console.WriteLine(filenames(i))
Next
Dim directories() As String =
System.IO.Directory.GetDirectories(path)
For i As Int16 = 0 To directories.Length - 1
ListAllExes(directories(i))
Next
Catch ex As Exception
' do nothing
End Try
End Sub

End Module
eSolTec wrote:
Thank you in advance for any and all assistance. I'm looking for a way to
programmatically scan all installed drives for programs that are installed.
Can someone point me to code to look for say, "keywords" on the installed
drives etc?
>
--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.
Oct 11 '06 #4
Hello Michael,

As Rowe has mentioned, you can use the System.IO's class to query and
search certain drives and directories on the machine. However, it is
important that you know tha keywords or naming convention of the programs
you want to search.

BTW, based on my experience, most program will add some configuration and
installation information in the system registry(under
HKEY_LOCAL_MACHINE\SOFTWARE key). For example, the Adobe reader will add
information like InstallPath, version in its registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader

Mozilla firefox will add its exeutable's name and path through the
following keys:

PathToExe
Program Folder Path

Therefore, you can also consider performing search in windows system
registry for the certain program's installation information and then
perform further search upon file system. How do you think? Here are some
reference about registry accessing in .net:

http://www.codeguru.com/csharp/cshar...ticle.php/c103
09/

http://www.csharphelp.com/archives2/archive430.html
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 11 '06 #5
Dear Mr. Bragg,
Seth,

Thank you for the demo console app. I'm looking to find particular programs
installed. Do you think I can modify this to find say all "symantec" programs
or "mcafee" ?
If you are looking for such (installed) programs, then perhaps it is
easier to check the registry. Maybe you find the path there
(HKLM\SOFTWARE\...). Getting the result from there should be much
quicker than scanning the hard drive. Of course, this won't help if you
need a list of ALL programs (no matter if installed or copied).

Best Regards,

HKSHK
Oct 11 '06 #6

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

Similar topics

4
by: could ildg | last post by:
I want to compare 2 directories, and find If all of theire sub-folders and files and sub-files are identical.. If not the same, I want know which files or folders are not the same. I know filecmp...
1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
0
by: John Salerno | last post by:
Is there a way for me to somehow specify that I want Python to search all subdirectories of a particular directory when I'm running or testing files from the command prompt? For example, I have...
10
by: Dan | last post by:
Hi - I'm about a week into learning VB.NET, and I'm finding I can't delete any of the VB.NET directory structures that contain my test projects I've been trying to create. I've never seen this...
1
by: rn5a | last post by:
A ListBox lists all the folders & files existing in a directory named 'MyDir' on the server. Assume that the ListBox lists 2 directories - 'Dir1' & 'Dir2' i.e. these 2 directories reside in the...
5
by: Jandre | last post by:
Hi I am a python novice and I am trying to write a python script (most of the code is borrowed) to Zip a directory containing some other directories and files. The script zips all the files fine...
9
by: Lloyd Sheen | last post by:
For all those who don't think that a recursive search of files in folders is a good thing in the Microsoft.VisualBasic.FileIO.FileSystem namespace listen to this. I am reorg my mp3 collection. ...
3
by: =?Utf-8?B?Tm9ybUQ=?= | last post by:
It isn't clear this is the right place to post this, but it IS related to ..NET CONFIG files... Windows Explorer (at least on W2003Server) doesn't seem to know that .config files exist. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.