Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# equivalent of Java's mkdirs()

Tags:

I am trying to convert a Java program to c#.

Is there a equivalent to Java's mkdirs() command which recursively makes folders?

like image 787
Ian Vink Avatar asked Mar 30 '11 05:03

Ian Vink


2 Answers

Simply:

Directory.CreateDirectory(pathToDir)

This will create any and all directories specified in the given path. (Just like mkdirs)

See the documentation here:

http://msdn.microsoft.com/en-us/library/54a0at6s.aspx

like image 81
jjnguy Avatar answered Sep 29 '22 14:09

jjnguy


Directory.CreateDirectory

Any and all directories specified in path are created, unless they already exist or unless some part of path is invalid

like image 4
Yuriy Faktorovich Avatar answered Sep 28 '22 14:09

Yuriy Faktorovich