How to create a directory if it can already exists?


Posted by Piero on December 12, 2001 9:43 AM

I need to know how to create a directory only if this directory does not already exists. I know that I can use the visual basic command "mkdir", but i cannot control the existence of the directory itself with the "chdir" command...if the dir doesn't exist the chdir gives an error that I connat manage!
What are the possible solution?
Thanks and bye!



Posted by Jacob on December 12, 2001 10:46 AM

A simple way to attack this would be to put a onerror string in your code then try to chdir and onerror make the directory and try again this way if the dir exists you would go to it error free and if it doesnt there would be an error and the dir would be created then it would try again and the second time it would exist.

Hope this gets you started.

Jacob