Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Search for folder

0 views
Skip to first unread message

Sue

unread,
Jun 18, 2002, 2:38:55 PM6/18/02
to
Hello,

This seems simple but I can't figure it out. Using VB, how
do I write code that searches all the fixed drives for a
folder that may be nested in subfolders? Here is what I
got so far. It works well if the folder comes immediately
after the drive letter (ex: c:\DATABASE\*.terr) but if it
is nested within some folder (c:\test\DATABASE\*.mdb), it
is not found. I already tried "\*\DATABASE|*.mdb" and it
didn't work but I must be doing something wrong.

Once this is solved, I will also need to know how to
capture the path string.

-----code----------
Dim Path as String

On Error Resume Next

For ii = 67 To 90 ' ASCII characters 'C' to 'Z'

Path = Chr(ii) & ":\DATABASE\db1.mdb"

If Len(Dir(Path)) > 0 Then
Exit For
End If

Next
--------
Thanks.
Sue

Val Mazur

unread,
Jun 18, 2002, 2:57:05 PM6/18/02
to
Hi Sue,

I think using Microsoft Scripting Runtime is simpler. This is
FileSystemObject library. Check it

--
Val Mazur
Microsoft MVP


"Sue" <sman...@comcast.com> wrote in message
news:e1e701c216f7$66f4d610$a4e62ecf@tkmsftngxa06...

Sue

unread,
Jun 18, 2002, 3:29:36 PM6/18/02
to
Hi Val,

You are getting to know me very well at this newsgroup. I
did try using the commands of the filesystemobject but got
nowhere b/c I could not find anything that gave me just
paths, not absolute paths. Can you make some explicit
suggestions for me?

Thanks. :)
Sue

>.
>

0 new messages