\u4e0a\u4f20\u4e8b\u4ef6\u89e6\u53d1<\/strong><\/div>\nprivate void Button1_Click(object sender, EventArgs e)\r\n {\r\n string path = textBox1.Text;\r\n CopyDirs(textBox3.Text,\r\n path);\r\n }<\/pre>\n.<\/p>\n
private void CopyDirs(string srcPath, string aimPath)\r\n {\r\n try\r\n {\r\n \/\/ \u68c0\u67e5\u76ee\u6807\u76ee\u5f55\u662f\u5426\u4ee5\u76ee\u5f55\u5206\u5272\u5b57\u7b26\u7ed3\u675f\u5982\u679c\u4e0d\u662f\u5219\u6dfb\u52a0\r\n if (aimPath[aimPath.Length - 1] != System.IO.Path.DirectorySeparatorChar)\r\n {\r\n aimPath += System.IO.Path.DirectorySeparatorChar;\r\n }\r\n \/\/ \u5224\u65ad\u76ee\u6807\u76ee\u5f55\u662f\u5426\u5b58\u5728\u5982\u679c\u4e0d\u5b58\u5728\u5219\u65b0\u5efa\r\n if (!System.IO.Directory.Exists(aimPath))\r\n {\r\n System.IO.Directory.CreateDirectory(aimPath);\r\n }\r\n \/\/ \u5f97\u5230\u6e90\u76ee\u5f55\u7684\u6587\u4ef6\u5217\u8868\uff0c\u8be5\u91cc\u9762\u662f\u5305\u542b\u6587\u4ef6\u4ee5\u53ca\u76ee\u5f55\u8def\u5f84\u7684\u4e00\u4e2a\u6570\u7ec4\r\n \/\/ \u5982\u679c\u4f60\u6307\u5411copy\u76ee\u6807\u6587\u4ef6\u4e0b\u9762\u7684\u6587\u4ef6\u800c\u4e0d\u5305\u542b\u76ee\u5f55\u8bf7\u4f7f\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\r\n \/\/ string[] fileList = Directory.GetFiles\uff08srcPath\uff09\uff1b\r\n string[] fileList = System.IO.Directory.GetFileSystemEntries(srcPath);\r\n \/\/ \u904d\u5386\u6240\u6709\u7684\u6587\u4ef6\u548c\u76ee\u5f55\r\n foreach (string file in fileList)\r\n {\r\n \/\/ \u5148\u5f53\u4f5c\u76ee\u5f55\u5904\u7406\u5982\u679c\u5b58\u5728\u8fd9\u4e2a\u76ee\u5f55\u5c31\u9012\u5f52Copy\u8be5\u76ee\u5f55\u4e0b\u9762\u7684\u6587\u4ef6\r\n if (System.IO.Directory.Exists(file))\r\n {\r\n CopyDir(file, aimPath + System.IO.Path.GetFileName(file));\r\n DisplaylistboxMsg(\"\u4e0a\u4f20\u6210\u529f\");\r\n }\r\n \/\/ \u5426\u5219\u76f4\u63a5Copy\u6587\u4ef6\r\n else\r\n {\r\n System.IO.File.Copy(file, aimPath + System.IO.Path.GetFileName(file), true);\r\n DisplaylistboxMsg(\"\u4e0a\u4f20\u6210\u529f\");\r\n }\r\n }\r\n }\r\n catch (Exception e)\r\n {\r\n DisplaylistboxMsg(\"\u4e0a\u4f20\u5931\u8d25\" + e.Message);\r\n }\r\n }<\/pre>\n\u4e0b\u8f7d\u4e8b\u4ef6\u89e6\u53d1<\/strong><\/div>\nprivate void Button2_Click(object sender, EventArgs e)\r\n {\r\n CopyDir(@\"\\\\10.55.2.3\\mech_production_line_sharing\\Test\\\" + textBox2.Text, textBox4.Text);\r\n }\r\n\r\nprivate void CopyDir(string srcPath, string aimPath)\r\n {\r\n \/\/ \u68c0\u67e5\u76ee\u6807\u76ee\u5f55\u662f\u5426\u4ee5\u76ee\u5f55\u5206\u5272\u5b57\u7b26\u7ed3\u675f\u5982\u679c\u4e0d\u662f\u5219\u6dfb\u52a0\r\n if (aimPath[aimPath.Length - 1] != System.IO.Path.DirectorySeparatorChar)\r\n {\r\n aimPath += System.IO.Path.DirectorySeparatorChar;\r\n }\r\n\r\n \/\/ \u5224\u65ad\u76ee\u6807\u76ee\u5f55\u662f\u5426\u5b58\u5728\u5982\u679c\u4e0d\u5b58\u5728\u5219\u65b0\u5efa\r\n if (!System.IO.Directory.Exists(aimPath))\r\n {\r\n System.IO.Directory.CreateDirectory(aimPath);\r\n }\r\n\r\n \/\/ \u5f97\u5230\u6e90\u76ee\u5f55\u7684\u6587\u4ef6\u5217\u8868\uff0c\u8be5\u91cc\u9762\u662f\u5305\u542b\u6587\u4ef6\u4ee5\u53ca\u76ee\u5f55\u8def\u5f84\u7684\u4e00\u4e2a\u6570\u7ec4\r\n \/\/ \u5982\u679c\u4f60\u6307\u5411copy\u76ee\u6807\u6587\u4ef6\u4e0b\u9762\u7684\u6587\u4ef6\u800c\u4e0d\u5305\u542b\u76ee\u5f55\u8bf7\u4f7f\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\r\n \/\/ string[] fileList = Directory.GetFiles\uff08srcPath\uff09\uff1b\r\n string[] fileList = System.IO.Directory.GetFileSystemEntries(srcPath);\r\n \/\/ \u904d\u5386\u6240\u6709\u7684\u6587\u4ef6\u548c\u76ee\u5f55\r\n foreach (string file in fileList)\r\n {\r\n \/\/ \u5148\u5f53\u4f5c\u76ee\u5f55\u5904\u7406\u5982\u679c\u5b58\u5728\u8fd9\u4e2a\u76ee\u5f55\u5c31\u9012\u5f52Copy\u8be5\u76ee\u5f55\u4e0b\u9762\u7684\u6587\u4ef6\r\n if (System.IO.Directory.Exists(file))\r\n {\r\n CopyDir(file, aimPath + System.IO.Path.GetFileName(file));\r\n DisplaylistboxMsg(\"\u4e0b\u8f7d\u6210\u529f\");\r\n }\r\n \/\/ \u5426\u5219\u76f4\u63a5Copy\u6587\u4ef6\r\n else\r\n {\r\n System.IO.File.Copy(file, aimPath + System.IO.Path.GetFileName(file), true);\r\n DisplaylistboxMsg(\"\u4e0b\u8f7d\u6210\u529f\");\r\n }\r\n }\r\n }<\/pre>\n","protected":false},"excerpt":{"rendered":"Model\u6587\u4ef6\u4e0b\u65b0\u5efa DbContext \u7c7b public class DbContext { public […]<\/p>\n","protected":false},"author":1482,"featured_media":229221,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-229419","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/229419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=229419"}],"version-history":[{"count":7,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/229419\/revisions"}],"predecessor-version":[{"id":229426,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/229419\/revisions\/229426"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/229221"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=229419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=229419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=229419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}