CreateFolder

by ssi 17. December 2015 10:54
public class clsFolders
   {
       public void CreateFolder(string sFolder)
       {
           try
           {
               // Determine whether the directory exists.
               if (Directory.Exists(sFolder))
               {
                   Console.WriteLine(string.Format("Path: {0} exists already.", sFolder ));
                   return;
               }
 
               // Try to create the directory.
               DirectoryInfo di = Directory.CreateDirectory(sFolder);
               Console.WriteLine("The directory was created successfully at {0}."Directory.GetCreationTime(sFolder));
 
               //// Delete the directory.
               //di.Delete();
               //Console.WriteLine("The directory was deleted successfully.");
           }
           catch (Exception e)
           {
               Console.WriteLine("The process failed: {0}", e.ToString());
           }
           finally { }
 
       }
 
   }

Tags: ,

CSharp

Add comment

biuquote
  • Comment
  • Preview
Loading

Calendar

<<  February 2026  >>
MoTuWeThFrSaSu
2627282930311
2345678
9101112131415
16171819202122
2324252627281
2345678

View posts in large calendar

RecentComments

None

Development Team @ Shelbysys

We develop custom database applications for our clients. Our development tool of choice is MS Visual Studio. 

Quotations

"The distance between insanity and genius is measured only by success."
Bruce Feirstein