wanna create a specific folder in particular drive using c#.net
I need to create a folder in any drive with some name using c#.net appplication.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Master BillaPosted Aug 13, 2009, 4:42 AM
Just call this method and give the name to folder and where you need create.
public void CreateFolder(string folderName, string parentdirectory)
{
if (string.IsNullOrEmpty(parentdirectory))
{
MessageBox.Show("Parent Directory can't empty");
}
if (string.IsNullOrEmpty(folderName))
{
MessageBox.Show("folderName can't empty");
}
if (!Directory.Exists(parentdirectory))
{
Directory.CreateDirectory(parentdirectory);
}
Directory.CreateDirectory(System.IO.Path.Combine(parentdirectory, folderName));
}
Thank you