Working with File Directory System in VB

techieguy
techieguy used Ask the Experts™
on
I'm developing an application for a Datawarehouse project. I'm developing an OLE object that will read file name from specified location and return that filename. This filename would be used to automate the process. Can anyone help me out? I need someone who could help me in writing code in VB for doing this task

Thanks
Pradeep
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
If you know the path and just need to find all files in there:

' This sends all files in a certain path to the immediate window
strFilename = Dir$(pathname) ' or & dir$(pathname & "\*.*")
while strFilename <> vbnullstring
  debug.print strFilename
  strFilename = Dir$
wend

Commented:
To see if the file exists, you can just use this:

if Dir$("Pathname\filename") = vbnullstring then
  msgbox "not found"
else
  msgbox "found"
endif

Commented:
Once i developed an application in Win95 to access the directoy structure of current window..sumthing like window explorer....may be this is what u r lokking for....

in vb add a reference of vb scripting object...then in general deceration

Dim filename As New Scripting.FileSystemObject.

I don't remember much of the coding but if u play with this object most probably ur query will be sloved....
Author of the Year 2009

Commented:
Hi techieguy,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept rspahitz's comment(s) as an answer.

techieguy, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept THIS comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial