private void CopyAll(string srcPath, string destPath)
{
try
{
DirectoryInfo dir = new DirectoryInfo(srcPath);
FileSystemInfo[] fileinfo = dir.GetFileSystemInfos();
foreach (FileSystemInfo i in fileinfo)
{
if (i is DirectoryInfo)
{
if (!Directory.Exists(destPath + "\\" + i.Name))
{
Directory.CreateDirectory(destPath + "\\" + i.Name);
}
CopyAll(i.FullName, destPath + "\\" + i.Name);
}
else
{
File.Copy(i.FullName, destPath + "\\" + i.Name, true);
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error");
}
}