如何编写一个自动生成文件软件?
using System.IO;string parentFolder = "文件夹名";
string[] folderArray = new string[]{"子文件夹1","子文件夹2","子文件夹3","子文件夹4"}
string parentFolderPath = string.Format{@"D:\{0}",parentFolder }
if (!Directory.Exists(parentFolderPath))
{
//没有自动生成文件夹
Directory.CreateDirectory(folderPath);
}
foreach(string folder in folderArray )
{
string folderPath = string.Format{@"{0}\{1}", parentFolderPath ,folder }
if(!Directory.Exists(folderPath)))
{
Directory.CreateDirectory(folderPath );
}
}
//是否四个子文件夹
DirectoryInfo theFolder = new DirectoryInfo(parentFolderPath );
if(theFolder.GetDirectories().Length == 4)
{
return true;
}
别说不懂,别吝啬分。