public static void Copy(string source, string dest) { if (!FileEx.Exists(source)) { throw new IOException("Source not exist."); } if (FileEx.Exists(dest)) { throw new IOException("Dest already exist."); } IOTools.Copy(source, dest); }
public static void Copy(string source, string dest) { if (!DirectoryEx.Exists(source)) { throw new IOException("Source not exist."); } //if (DirectoryEx.Exists(dest)) // throw new IOException("Dest already exist."); IOTools.Copy(source, dest); string[] subFiles = GetFiles(source); foreach (string subFile in subFiles) { IOTools.Copy(subFile, subFile.Replace(source, dest)); } string[] subDirs = GetDirectories(source); foreach (string subdir in subDirs) { Copy(subdir, subdir.Replace(source, dest)); } }