• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 151
  • Last Modified:

How do I search for a file?

What's the best method to search for a file on the hard drive on Win9x, NT, and Win2000 systems?

I need to find out if my application was already installed, and if so, where...  Of course I could write out a registry entry, but without this, what's the next best method?
0
VBDesigns
Asked:
VBDesigns
  • 3
  • 3
  • 2
1 Solution
 
vbWayneCommented:
'does file exist using fso

Dim sFile$

sFile = "Name And Path Of Your File"

Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")

If fs.fileexists(sFile$) = True Then
      MsgBox "File Exists...Your code here!"
Else
      MsgBox "Does Not Exist...Your code here!"
End If
      Set fs = Nothing


0
 
vbWayneCommented:
Ooops...the above only works if you know tht path. Sorry.
0
 
VBDesignsAuthor Commented:
If I knew the path I wouldn't have to search!  Sorry, I don't see how this answer applies unless the external call searches all hard drives and returns a directory.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
kamallCommented:
There is a sample project that comes with VB5, which demonstrates how to search the disk(s) for a specific file(s). The sample project is located under the VB5..\Samples\Misc\FileCts - (its name is Winseek.vbp).
Regards.
0
 
VBDesignsAuthor Commented:
I only have VB6.  I'll have to install the samples I guess.  I was just hoping there was a way to hook into the OS file search mechanism...
0
 
kamallCommented:
If you like, I can e-mail it to you.
Comment me your e-mail address.
0
 
VBDesignsAuthor Commented:
Actually, I went ahead and used the registry for what I needed to do.  I'll give you the points for answering though - thanks!
0
 
kamallCommented:
Thanks and you are welcome.
Happy new year.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now