This code written to copy files and folders recursively from one drive to another drive using C#, It could be physical storage, logical storage or network location. private static void Copy(string sourcePath, string targetPath) { foreach (string f in Directory.GetFiles(sourcePath)) File.Copy(f, targetPath + "\\" + Path.GetFileName(f), true); foreach (string d in Directory.GetDirectories(sourcePath)) { var dirName = Path.GetFileName(d); Directory.CreateDirectory(targetPath + "\\" + dirName); Copy(sourcePath + "\\" + dirName, targetPath + "\\" + dirName); ...
Comments
Post a Comment