Code In-Line:
using System.IO;
using System.Text;
protected void btnDir_Click(object sender, EventArgs e)
{
try
{
string DirName = txtDir.Text;
string SubDirName = txtSubDir.Text;
dir.CreateSubdirectory(DirName);
string concat= DirName + "\\" + SubDirName;
dir.CreateSubdirectory(@concat);
Response.Write("Directory created");
}
catch (IOException ex)
{
Console.WriteLine(ex.Message);
}
}
protected void btnDelDir_Click(object sender, EventArgs e)
{
try
{
string DirName = txtDir1.Text;
string concat= @"D:\" + DirName;
DirectoryInfo dir1 = new DirectoryInfo(concat);
dir1.Delete(true);
Response.Write("Directory deleted");
}
catch (IOException ex)
{
Console.WriteLine(ex.Message);
}
}
using System.IO;
using System.Text;
protected void btnDir_Click(object sender, EventArgs e)
{
try
{
string DirName = txtDir.Text;
string SubDirName = txtSubDir.Text;
dir.CreateSubdirectory(DirName);
string concat= DirName + "\\" + SubDirName;
dir.CreateSubdirectory(@concat);
Response.Write("Directory created");
}
catch (IOException ex)
{
Console.WriteLine(ex.Message);
}
}
protected void btnDelDir_Click(object sender, EventArgs e)
{
try
{
string DirName = txtDir1.Text;
string concat= @"D:\" + DirName;
DirectoryInfo dir1 = new DirectoryInfo(concat);
dir1.Delete(true);
Response.Write("Directory deleted");
}
catch (IOException ex)
{
Console.WriteLine(ex.Message);
}
}
No comments:
Post a Comment