标签:
private static void CopyDir(DirectoryInfo origin, string target) { if (!target.EndsWith("\\")) { target += "\\"; } if (!Exist(target)) { Create(target); //Create(target, origin.GetAccessControl()); } FileInfo[] fileList = origin.GetFiles(); DirectoryInfo[] dirList = origin.GetDirectories(); foreach (FileInfo fi in fileList) { File.Copy(fi.FullName, target + fi.Name, true); } foreach (DirectoryInfo di in dirList) { CopyDir(di, target + di.Name); } DirectoryInfo tmp = new DirectoryInfo(target); tmp.Attributes = origin.Attributes; tmp.SetAccessControl(origin.GetAccessControl()); }
标签:
原文地址:http://www.cnblogs.com/HF520134/p/4651567.html