Mega Code Archive

 
Categories / C# / File Stream
 

Instance methods for creating, moving, and enumerating through directories and subdirectories

using System; using System.IO; class Test  {     public static void Main()      {         DirectoryInfo di = new DirectoryInfo(@"c:\MyDir");         // Determine whether the directory exists.         if (di.Exists)          {                 Console.WriteLine("That path exists already.");                 return;         }         di.Create();         Console.WriteLine("The directory was created successfully.");         di.Delete();         Console.WriteLine("The directory was deleted successfully.");     } }