using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace qidi
{
class Program
{
static void Main(string[] args)
{
CopyFolder(@"F:\C#",@"F:\dddd");
}
static void CopyFolder(string sPath, string dPath)
{
if (!Directory.Exists(dPath))
{
Directory.CreateDirectory(dPath);
DirectoryInfo sDir = new DirectoryInfo(sPath);
FileInfo[] fileArray = sDir.GetFiles();
foreach (FileInfo file in fileArray)
{
file.CopyTo(dPath + "\\" + file.Name, true);
}
DirectoryInfo[] subDirArray = sDir.GetDirectories();
foreach (DirectoryInfo subDir in subDirArray)
{
CopyFolder(subDir.FullName, dPath + "//" + subDir.Name);
}
}
}
}
}