My.Class.IO.DirOperate.CopyDir(string strFromDirectory, string strToDirectory)
public bool CopyDir(string strFromDirectory, string strToDirectory) { Directory.CreateDirectory(strToDirectory); if (!Directory.Exists(strFromDirectory)) return false; string[] directories = Directory.GetDirectories(strFromDirectory); if (directories.Length > 0) { foreach (string d in directories) { CopyDir(d, strToDirectory + d.Substring(d.LastIndexOf("\\"))); } } string[] files = Directory.GetFiles(strFromDirectory); if (files.Length > 0) { foreach (string s in files) { File.Copy(s, strToDirectory + s.Substring(s.LastIndexOf("\\"))); } } return true; }