/// <summary>
/// 拷贝文件夹
/// </summary>
private static void CopyFolder(string from, string to)
{
	if (!to.EndsWith("\\"))
	{
		to += "\\";
	}

	if (!Directory.Exists(to))
		Directory.CreateDirectory(to);

	// 子文件夹
	foreach (string sub in Directory.GetDirectories(from))
		CopyFolder(sub + "\\", to + Path.GetFileName(sub) + "\\");

	// 文件
	foreach (string file in Directory.GetFiles(from))
		File.Copy(file, to + Path.GetFileName(file), true);
}

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-16
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
相关资源
相似解决方案