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.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Master BillaRank #2,229 · 630 reputationPosted Aug 13, 2009, 12:42 AM EDT
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