static void Main()
// Create new folder in C:\ volume.
// Create another directory with different syntax.
// Create an already-existing directory (does nothing).
}There are 2 folders on your C:\ drive:
Exceptions. When interfacing with the file system, you should always prepare for exceptions and provide code for recovering from them. CreateDirectory() throws 7 types of exceptions.
Tip Depending on the purpose of your program, you can log these exceptions of terminate your program with an error message.
Clear. To clear an entire directory if it exists, you can call Directory.Exists, and then Directory.GetFiles, and finally File.Delete on each path.
Also We sometimes need to recursively walk through directories. A variety of methods can be used.