|
|
A lot of developers do not know that Directory.CreateDirectory() can be used to create directories and subdirectories as specified by the path. Here’s an example
C#
static void Main(string[] args)
{
try
{
Directory.CreateDirectory(@"D:\ParentDir\ChildDir\SubChildDir\");
Console.WriteLine("Directories Created");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
VB.NET
Shared Sub Main(ByVal args() As String)
Try
Directory.CreateDirectory("D:\ParentDir\ChildDir\SubChildDir\")
Console.WriteLine("Directories Created")
Console.ReadLine()
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
OUTPUT
'Like' us on our FaceBook page if you find this blog useful. Thanks!
Did you like this post?
|
|
|
||
|
|
|
|
Save on Delicious |
|
|
subscribe via rss |
|
subscribe via e-mail |
|
|
print this post |
|
follow me on twitter |





comments
2 Responses to "Create Nested Directories in C# and VB.NET"The .NET framework comes bundled with a lot of advantages, which makes it widely used tool for .NET application development. In .NET ,
I need some explanation regarding c# to vb conversion..
Anykind of help would be greatly appreciated.
Your article is very interesting. It is very useful and helpful for the Developers to develop the application. Thanks for share this valuable post.
Post a Comment