c#拷贝整个文件夹到指定文件夹下(非递归)
2021-07-04 01:07
标签:option stat stp arch search rect creat static copy c#拷贝整个文件夹到指定文件夹下(非递归) 标签:option stat stp arch search rect creat static copy 原文地址:https://www.cnblogs.com/lee2011/p/9867750.html 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);
}
文章标题:c#拷贝整个文件夹到指定文件夹下(非递归)
文章链接:http://soscw.com/index.php/essay/101511.html