|
-
Jul 31st, 2001, 10:57 AM
#12
Originally posted by nishantp
Sorry, sorry, I did test it...just not enough. The above code it wrong, it works but only on root directories...not sub dirs. This code does the trick (has been tested properly) :
VB Code:
Function DirExist(ByVal Path As String) As Boolean
If Right(Path, 1) <> "\" Then Path = Path & "\"
DirExist = Dir(Path, vbDirectory) <> ""
End Function
Thanks for the pointers Tygur
I'm guessing you didn't test its reaction to files 
It will return true if you give it a file. Since it's supposed to check for the existence of a directory, not a file, it should return false.
EDIT: I just tested it myself, and I found that it gives an error if you give it a filename, instead of just returning true. The function posted by [Digital-X-Treme] does the same thing.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|