Link to home
Start Free TrialLog in
Avatar of GMorgan
GMorgan

asked on

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.
Avatar of xSinbad
xSinbad

ASKER CERTIFIED SOLUTION
Avatar of xSinbad
xSinbad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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"
Actually, you may need to prefix the Dir with a command processor:

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

Avatar of GMorgan

ASKER

Thanks for the example it runs super fast!