Finding a file in a directory

saj

New member
Local time
Today, 05:49
Joined
Feb 10, 2011
Messages
3
Just wondering if there's some sort of native function that when given an absolute path to a directory and the name of the file, the function returns true/false based on whether or not that directory contains the provided file name? Or at least some similar function that I could use to get the same end result (discover whether or not a file is in a directory).

I did some snooping on Google for something but just found people writing their own functions that used a linear search through the directory. Was just hoping there was something better out there that I was overlooking.
 
Yep, it is DIR -

If DIR(PathToFile) <> vbNullString Then

the file exists

If DIR(PathToFile) = vbNullString Then

the file does not exist.
 
Ahhh I saw Dir being used but just thought it was used to grab the next file in the directory; but after checking the API I see that's not the case. Thanks for the reply though Bob.
 

Users who are viewing this thread

Back
Top Bottom