From eb7ae609e499d5f1faa801299aa17a8cd05d676f Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 27 六月 2023 15:01:07 +0800 Subject: [PATCH] 移动TB文件 --- ExportMap/cs/TBUtils.cs | 27 ++++++++++++++++++--------- 1 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ExportMap/cs/TBUtils.cs b/ExportMap/cs/TBUtils.cs index 741fab9..9958009 100644 --- a/ExportMap/cs/TBUtils.cs +++ b/ExportMap/cs/TBUtils.cs @@ -89,18 +89,27 @@ /// </summary> private static void MoveFilesToTemp(string sourcePath, string targetPath) { - string imgPath = Path.Combine(targetPath, "img"); - //if (!Directory.Exists(imgPath)) Directory.CreateDirectory(imgPath); + CopyFolder(Path.Combine(sourcePath, "鏁板瓧姝e皠褰卞儚鍥�"), Path.Combine(targetPath, "img")); + CopyFolder(Path.Combine(sourcePath, "鏁板瓧楂樼▼妯″瀷"), Path.Combine(targetPath, "dem")); + CopyFolder(Path.Combine(sourcePath, "涓嚎瑁佸壀鑼冨洿"), Path.Combine(targetPath, "shp")); + } - string demPath = Path.Combine(targetPath, "dem"); - //if (!Directory.Exists(demPath)) Directory.CreateDirectory(demPath); + /// <summary> + /// 澶嶅埗鐩綍 + /// </summary> + private static void CopyFolder(string sourcePath, string targetPath) + { + if (!Directory.Exists(targetPath)) Directory.CreateDirectory(targetPath); - string shpPath = Path.Combine(targetPath, "shp"); - //if (!Directory.Exists(shpPath)) Directory.CreateDirectory(shpPath); + DirectoryInfo di = new DirectoryInfo(sourcePath); - File.Move(Path.Combine(sourcePath, "鏁板瓧姝e皠褰卞儚鍥�"), imgPath); - File.Move(Path.Combine(sourcePath, "鏁板瓧楂樼▼妯″瀷"), demPath); - File.Move(Path.Combine(sourcePath, "涓嚎瑁佸壀鑼冨洿"), shpPath); + FileInfo[] files = di.GetFiles(); + if (null == files || 0 == files.Length) return; + + foreach (FileInfo fi in files) + { + File.Move(fi.FullName, Path.Combine(targetPath, fi.Name)); + } } /// <summary> -- Gitblit v1.9.3