21

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

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

Ian Vink
  • 66,960
  • 104
  • 341
  • 555

2 Answers2

33

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

jjnguy
  • 136,852
  • 53
  • 295
  • 323
4

Directory.CreateDirectory

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

Yuriy Faktorovich
  • 67,283
  • 14
  • 105
  • 142