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

<<  July 2025  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

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

"Fill the unforgiving minute with sixty seconds worth of distance run."
Rudyard Kipling