CreateDirectory (kernel32)
Last changed: WithLithum-112.101.111.191

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool CreateDirectory(string lpPathName,
   IntPtr lpSecurityAttributes);

User-Defined Types:

None.

Notes:

Advantage - Doesn't require the running assembly to have permissions to the entire folder path.

Disadvantage - Only creates the end-most directory, not the full path.

Tips & Tricks:

Please add some!

Sample Code:

string path = "c:\\test\\newDir";
CreateDirectory(path, IntPtr.Zero);

Alternative Managed API:

string path = "c:\\test\\newDir";
System.IO.Directory.CreateDirectory(path);

Documentation