Create Directory Using VB.NET
In this article I describe how to create directory using VB.NET.
Create a Directory
The System.IO.Directory class in the .NET Framework class library provides static methods for creating, copying, moving, and deleting directories and subdirectories. Before you can use the Directory class, you must import the System.IO namespace.
Imports System.IO
The Directory.CreateDirectory method creates a directory in the specified path with the specified Windows security. You can also create a directory on a remote computer.
The following code snippet creates a Temp folder in C:\ drive if the directory does not exists already.
Imports System.IO
Module Module1
Sub Main()
Dim root As String = "C:\Temp"
Dim subdir As String = "C:\Temp\Mahesh"
'If directory does not exist, create it.
If Not Directory.Exists(root) Then
Directory.CreateDirectory(root)
End If
End Sub
End Module
Output: