public int DirectoryName(string DirectoryPath)//獲取文件夾名
{
int j =
for (int i = c
{
j = i;
if (c[i] ==
{
break;//遇
}
}
return j+
}
public void CopyDirectory(string DirectoryPath
{
#region//遞歸
string s = DirectoryPath
if (Directory
{
Directory
Directory
}
else
{
Directory
}
DirectoryInfo DirectoryArray = new DirectoryInfo(DirectoryPath);
FileInfo[] Files = DirectoryArray
DirectoryInfo[] Directorys = DirectoryArray
foreach (FileInfo inf in Files)//逐個復制文件
{
File
}
foreach (DirectoryInfo Dir in Directorys)//逐個獲取文件夾名稱
{
CopyDirectory(DirectoryPath +
}
#endregion
}
以上是已經通過檢驗成功的代碼
以下是代碼:
#region
//方法一:DOS命令:xcopy c:\docume~
string s = DirectoryPath
Directory
System
process
process
process
process
process
process
process
process
#endregion
From:http://tw.wingwit.com/Article/program/net/201311/11953.html