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); } }
public void CopyFile(string from, string to) { if (!FileUtils.FileExists(to) || FileUtils.LastWriteTimeForFile(from) > FileUtils.LastWriteTimeForFile(to)) { FileUtils.CopyFile(from, to); } }