整理代码块
代码块整理后存储,供后期使用
/// <summary>
/// 复制文件及其内部文件
/// </summary>
/// <param name="sources">源文件</param>
/// <param name="dest">目标文件</param>
/// <param name="cover">同名是否覆盖</param>
public static void CopyFile(string sources, string dest, bool cover)
{
var dinfo = new DirectoryInfo(sources);
foreach (FileSystemInfo f in dinfo.GetFileSystemInfos())
{
var destName = Path.Combine(dest, f.Name);
if (f is FileInfo)
{
File.Copy(f.FullName, destName, cover);
}
else
{
Directory.CreateDirectory(destName);
CopyFile(f.FullName, destName, cover);
}
}
}
标签:CopyFile,代码,cover,var,文件夹,复制,CS,destName
From: https://www.cnblogs.com/Katakana/p/17615637.html