复制文件夹的方法 .net
void CopyDirectory(string SourcePath,string DestinationPath) { //创建所有目录 foreach(string dirPath inDirectory.GetDirectories(SourcePath,"*",SearchOption.AllDirectories)) Directory.CreateDirectory(dirPath.Replace(SourcePath,DestinationPath)); //复制所有文件 foreach(string newPath inDirectory.GetFiles(SourcePath,"*.*",SearchOption.AllDirectories)) File.Copy(newPath, newPath.Replace(SourcePath,DestinationPath)); }
参考网址 http://stackoverflow.com/questions/58744/best-way-to-copy-the-entire-contents-of-a-directory-in-c-sharp