source_dir = @"f:";
destination_dir =@"e:";
//Now Create all of the directories
foreach (string dirPath in System.IO.Directory.GetDirectories(source_dir, "*",
System.IO.SearchOption.AllDirectories))
System.IO.Directory.CreateDirectory(dirPath.Replac e(source_dir, destination_dir));
//Copy all the files & Replaces any files with the same name
foreach (string newPath in System.IO.Directory.GetFiles(source_dir, "*.*",
System.IO.SearchOption.AllDirectories))
System.IO.File.Copy(newPath, newPath.Replace(source_dir, destination_dir), true);
برچسب:
نویسنده: خنج