CSharp examples for File IO:Directory
Copy Directory Recursive Internal
using System.Threading.Tasks; using System.Linq; using System.IO;/* w w w . jav a2s. c om*/ using System; public class Main{ private static void CopyDirectoryRecursiveInternal(DirectoryInfo source, string destination) { if (!Directory.Exists(destination)) Directory.CreateDirectory(destination); foreach (var file in source.GetFiles()) file.CopyTo(Path.Combine(destination, file.Name)); foreach (var directory in source.GetDirectories()) CopyDirectoryRecursiveInternal(directory, Path.Combine(destination, directory.Name)); } }