How to create a folder if it does not exist in C#?To create a folder if not exist in C# we need to do that in 2 steps:
- Step 1) Use
System.IO.Directory.Exists()which takes the path as parameter and return a boolean true if folder exist, and false if not exist.
- Step 2) Use
System.IO.Directory.CreateDirectory();which takes the path as parameter and create the folder based on that parameter.