public void CopyDirectory(string from, string to, IEnumerable <string> excludes, IEnumerable <string> includes) { if (!DirectoryUtils.DirectoryExists(to) || DirectoryUtils.GetLastModTimeForDirectory(from) > DirectoryUtils.GetLastModTimeForDirectory(to)) { DirectoryUtils.CopyDirectory(from, to, excludes, includes); } }
public void Copy(string from, string to, IEnumerable <string> excludes, IEnumerable <string> includes, bool deleteToDirectory) { if (DirectoryUtils.DirectoryExists(from)) { if (deleteToDirectory) { DirectoryUtils.DeleteDirectoryContents(to); } DirectoryUtils.CopyDirectory(from, to, excludes, includes); } else { string dest; if (DirectoryUtils.DirectoryExists(to)) { dest = Path.Combine(to, Path.GetFileName(from)); } else { DirectoryUtils.CreateDirectory(Path.GetDirectoryName(to)); dest = to; } FileUtils.CopyFile(from, dest); } }