using System;
using System.IO;
using System.Security;
using System.Windows.Forms;
namespace ConsoleApplication1
{
partial class Program
{
static bool CreateFolder(string strPath)
{
try
{
DirectoryInfo di =
new DirectoryInfo(strPath);
if (!di.Exists)
{
di.Create();
}
return (di.Exists);
}
catch (SecurityException ex)
{
MessageBox.Show(ex.Message,
ex.GetType().ToString());
return false;
}
catch (ArgumentException ex)
{
MessageBox.Show(ex.Message,
ex.GetType().ToString());
return false;
}
catch (IOException ex)
{
MessageBox.Show(ex.Message,
ex.GetType().ToString());
return false;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,
ex.GetType().ToString());
return false;
}
}
}
}
|