How To Ideas | How To Articles | How To Tutorials


0

How To Create A New Folder Using C#


IF you want your application to create folders or directories dynamically at run time to save any kind of data or files, you can do so by using any of the following command/method. 
  

  1. System.IO.Directory.CreateDirectory(@"D:\hello")
  2. System.IO.DirectoryInfo dinfo = new DirectoryInfo(@"D:\hello");
    dinfo.Create();

 

If you want to check whether a directory with the name you specified already exists or not then you can try the following method

  System.IO.DirectoryInfo dinfo = new DirectoryInfo(@"D:\hello"); 
  if (!dinfo.Exists) //checks if the directory already exists or not 
  { 
      dinfo.Create(); 
  }

Filed in: C# Tags: , , , , , , , , , ,

Leave a Reply

Submit Comment



© 2013 How To Ideas. All rights reserved.
Proudly designed by Theme Junkie.