?
Solved

file find question

Posted on 2003-02-20
9
Medium Priority
?
127 Views
Last Modified: 2010-04-07
i want to check the existance of a file in my path (which is set thru my autoexec.bat)

any quick way?
0
Comment
Question by:ackid32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 11

Expert Comment

by:rdrunner
ID: 7986009
is it one ore more paths you can set there?

one path is easy

Dim ofso As New FileSystemObject
Debug.Print ofso.FileExists(Environ("mypath") & "\myFile.txt")

for more then one path you would need to split them into an array and check for each element
0
 

Expert Comment

by:XpGautham
ID: 7986020
if len(dir("c:\File.txt",vbNormal) <> 0 then
  msgbox "File Found !!!",vbinformation
else
  msgbox "File Not Found !!!",vbCritical
end if

if it is a system file use vbSystem instead of vbnormal
0
 
LVL 9

Expert Comment

by:Naveen Swamy
ID: 7991944
if dir("c:\File.txt",6) = "" then
    msgbox "File not found"
end if
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:ackid32
ID: 7992274
i may have paths like c:\windows\;c:\windows\system;c:\windows\command;d:\utils
not only like this but also vary
0
 
LVL 11

Accepted Solution

by:
rdrunner earned 200 total points
ID: 7995803
For a full path list you need this

Dim ofso As New FileSystemObject
dim aPath as string
dim i as integer
apath=split(Environ("mypath"),";")
for i = 0 to ubound(apath)
  if ofso.FileExists(apath(i) & "\myFile.txt") then exit for
next
if i <= ubound(apath) then msgbox " the file exits at : " & apath(i)
0
 

Author Comment

by:ackid32
ID: 7998107
any other simple way?
0
 
LVL 11

Expert Comment

by:rdrunner
ID: 7998115
thats the simple one ;)
0
 

Expert Comment

by:CleanupPing
ID: 8901396
ackid32:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8963859
Moderator, my recommended disposition is:

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

DanRollins -- EE database cleanup volunteer
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question