Link to home
Start Free TrialLog in
Avatar of dimensionav
dimensionavFlag for Mexico

asked on

How to know if there is a directory and how to create it ?

How could I know if a directory exists and if not, how to create it ?

Regards
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
With all due respect to kaufmed, that won't work
No worries. It's been a while since I had to do that in VB6. Now that you posted it, I recall having to check the attributes on the file also. Now I remember why I was so glad to move on from VB6  ; )
Glad you understand and I didn't step on any toes. Ya know, I think it's a bug in VB6...if you ask for a directory with the Dir$ command, you should only get directories. But if a file or directory exists with that name, you'll get it returned. You should not have to also check the file's attribute.

Like you say, .NET behaves much nicer :-)
The first time I saw an article describing that process I thought to myself, "I thought programming was supposed to make things easier. Why does it take XX lines to answer the question, 'Does this directory exist?'."

= D