Check if a directory does not exist, create a directory
Imports System.IO
Module Module1
Sub Main()
Try
If (Directory.Exists("D:\test01")) Then
Console.WriteLine("D:\test01 already exists")
Else
Directory.CreateDirectory("C:\test01")
End If
Console.WriteLine("Directories created")
Catch E As Exception
Console.WriteLine("Error creating directory")
Console.WriteLine("Error: {0}", E.Message)
End Try
End Sub
End Module
Related examples in the same category