Copy directory
using System;
using System.IO;
using System.Windows.Forms;
using System.Text;
class Util
{
public static void CopyDirectory(string src, string dst, bool overwrite)
{
Directory.CreateDirectory(dst);
foreach (string dir in Directory.GetDirectories(src))
{
CopyDirectory(dir, Path.Combine(dst, Path.GetFileName(dir)), overwrite);
}
foreach (string file in Directory.GetFiles(src))
{
string dstFile = Path.Combine(dst, Path.GetFileName(file));
File.Copy(file, dstFile, true);
}
}
}
Related examples in the same category