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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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"
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")
shell(environ("ComSpec") & " /c Dir filename.extension /s /b> C:\tempfile.xxx")
ASKER
Thanks for the example it runs super fast!
http://www.mvps.org/vbnet/index.html?code/fileapi/recursive.htm