

1 private void CopyFiles(string strSouPath, string strDesPath)
2 {
3 Directory.CreateDirectory(strDesPath);
4
5 if (!Directory.Exists(strSouPath)) return;
6
7 string[] directories = Directory.GetDirectories(strSouPath);
8
9 if (directories.Length > 0)
10 {
11 foreach (string d in directories)
12 {
13 CopyFiles(d, strDesPath + d.Substring(d.LastIndexOf("\\")));
14 }
15 }
16
17 string[] files = Directory.GetFiles(strSouPath);
18
19 if (files.Length > 0)
20 {
21 foreach (string s in files)
22 {
23 File.Copy(s, strDesPath + s.Substring(s.LastIndexOf("\\")));
24 }
25 }
26 }