-1

I need to know how i can check if the folder exist, and if it does not exist, create it

For Example:

If File.Exists(File Path) Then

   Else
       'Create a new folder following the path(Path here)
End If

And Thanks for your help.

Mousa Alfhaily
  • 1,260
  • 3
  • 20
  • 38

1 Answers1

0

You might want to consider using this class in order to determine if the folder exists: .Net Directory Class, as well as .Net File Class in order to find the functionality you need. Both of them offers an "Exists" function and a "Create" function.

If you have the case where multiple folders in the path don't exist (which you might want to consider checking for), you would need to include a loop to iterative create every folder in the path until you've reached your destination.

Lars Sorenson
  • 39
  • 1
  • 2
  • Since you're duplicating an answer, why not [include relevant code](http://stackoverflow.com/a/86016/1454048) as well? – admdrew Feb 18 '14 at 21:17
  • Didn't realize this was a duplicate answer. I answered ~1 hr before it was marked a duplicate, and I honestly didn't bother to search for it before I answered. My apologies. – Lars Sorenson Apr 29 '14 at 03:31