private static void CopyEntireDir(string sourcePath, string destPath)
{
foreach (string dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories))
{
Directory.CreateDirectory(dirPath.Replace(sourcePath, destPath));
}
foreach (string newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories))
{
File.Copy(newPath, newPath.Replace(sourcePath, destPath), true);
}
}
如果您觉得我的文章对您有所帮助,欢迎扫码进行赞赏!