Search for a File Or Folder On Any Local Drive

I'm sure that I should know this or could figure it out if I had more time but I thought I would ask if anyone has code to seach for any file or folder on any local drive and then display it's path.
GMorganAsked:
Who is Participating?
 
xSinbadCommented:
Here is another one;
http://www.mvps.org/btmtz/drvscan/
0
 
xSinbadCommented:
0
 
rspahitzCommented:
This works in DOS and can be used in VB:

DOS:
Dir filename.extension /s /b

VB:
shell("Dir filename.extension /s /b> C:\tempfile.xxx")
open "C:\tempfile.xxx" for input as #1
line input #1, MyVar
close #1
Label1.Caption = MyVar
kill "C:\tempfile.xxx"
0
 
rspahitzCommented:
Actually, you may need to prefix the Dir with a command processor:

shell(environ("ComSpec") & " /c Dir filename.extension /s /b> C:\tempfile.xxx")

0
 
GMorganAuthor Commented:
Thanks for the example it runs super fast!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.