CodePudding user response:
//refactoring, dry type, you seePublic void CheckFile (string path)
{
Try
{
if(! Directory. The exists (path))
{
Directory. CreateDirectory (path);
}
}
The catch (Exception ex)
{
//loghelper WriteErrlog (ex);
Throw the ex.
}
}
CodePudding user response:
Use directly without judgment, this method itself with judgment, not to build, has not builtCodePudding user response:
Thank you, but I mean, in the same parent folder how to create more child folder; If you create user folder on disk C, then how to this folder to create 10 subfolders (input) don't have to asmCodePudding user response:
My account Posting is not quite clear, sorryIn the 3 f and then followed by the "in" word
thank you
CodePudding user response:
DirectoryInfo root=new DirectoryInfo (@ "d:/ABC");
if (! Root. The Exists)
Root. The Create ();
New List()
{
"Ab", "bb"
}. ForEach (p=& gt;
{
Try
{
Root. CreateSubdirectory (p);
}
The catch (Exception e)
{
Console. WriteLine (e);
Throw;
}
});