/// <summary> /// 拷贝文件夹 /// </summary> private static void CopyFolder(string from, string to) { if (!to.EndsWith("\\")) { to += "\\"; } if (!Directory.Exists(to)) Directory.CreateDirectory(to); // 子文件夹 foreach (string sub in Directory.GetDirectories(from)) CopyFolder(sub + "\\", to + Path.GetFileName(sub) + "\\"); // 文件 foreach (string file in Directory.GetFiles(from)) File.Copy(file, to + Path.GetFileName(file), true); }
欢迎转载,转载请注明:转载自[ http://www.cnblogs.com/zjfree/ ]