标签:
#region 文件覆盖 /// <summary> /// 文件覆盖 /// </summary> /// <param name="destPath"></param> public void FileCopy(string destPath) { string path = "UploadFiles\\BaiYuApparelERPUpdate\\" + destPath; string filePath = ServerInfo.GetRootPath() + path; DirectoryInfo rootDirectory = new DirectoryInfo(filePath); ///////获取其所有子文件夹 DirectoryInfo[] directories = rootDirectory.GetDirectories(); foreach (DirectoryInfo temp in directories) { if (!Directory.Exists(ServerInfo.GetRootPath() + destPath + temp.Name))//检查文件夹是否存在,如果不存在则先创建文件夹 { temp.MoveTo(ServerInfo.GetRootPath() + destPath + temp.Name); } else { FileCopy(destPath + temp.Name + "\\"); } } ///////获取其所有子文件 FileInfo[] files = rootDirectory.GetFiles(); foreach (FileInfo temp in files) { temp.CopyTo(ServerInfo.GetRootPath() + destPath + temp.Name, true); } } #endregion
标签:
原文地址:http://www.cnblogs.com/deep-blue/p/5109994.html