public static void CopyEntireDir(string sourcePath, string destPath)
{
//Now Create all of the directories
foreach (string dirPath in Directory.GetDirectories(sourcePath, "*",
SearchOption.AllDirectories))
Directory.CreateDirectory(dirPath.Replace(sourcePath, destPath));
//Copy all the files & Replaces any files with the same name
foreach (string newPath in Directory.GetFiles(sourcePath, "*.*",
SearchOption.AllDirectories))
File.Copy(newPath, newPath.Replace(sourcePath, destPath), true);
}
第一个参数为需要复制的文件夹路径,第二个参数为移动到的文件夹路径