public static void CopyDirectory(string source, string destination)
{
if (Directory.Exists(source))
{
if (Directory.Exists(destination) == false)
{
Directory.CreateDirectory(destination);
}
string[] files = Directory.GetFiles(source);
for (int i = 0; i < files.Length; i++)
{
File.Copy(files[i], destination + files[i].Substring(files[i].LastIndexOf('\\')), true);
}
string[] directories = Directory.GetDirectories(source);
for (int i = 0; i < directories.Length; i++)
{
CopyDirectory(directories[i], destination + directories[i].Substring(directories[i].LastIndexOf('\\')));
}
}
}