Io HelperCopy Directory Simple 方法
递归复制整个目录(含子目录)及文件到目标路径
最简单的纯粹复制粘贴
如果目标路径不存在则会自动新建
如果复制过程中某个子目录失败,则立即停止并返回错误
最简单的纯粹复制粘贴
如果目标路径不存在则会自动新建
如果复制过程中某个子目录失败,则立即停止并返回错误
Definition
命名空间: Suresking.Utility
程序集: Suresking.Utility (在 Suresking.Utility.dll 中) 版本:1.3.22+a27276bb8ffde055e69ff608e98aafba279e1e99
包含操作结果的 ResultStatus
程序集: Suresking.Utility (在 Suresking.Utility.dll 中) 版本:1.3.22+a27276bb8ffde055e69ff608e98aafba279e1e99
C#
public static ResultStatus CopyDirectorySimple(
string sourceDir,
string destinationDir,
bool recursive = true
)参数
- sourceDir String
- 源目录路径(必须存在)
- destinationDir String
- 目标目录路径(不存在则自动创建)
- recursive Boolean (Optional)
- 是否递归复制子目录,默认为 true
返回值
ResultStatus包含操作结果的 ResultStatus
示例
var result = IoHelper.CopyDirectorySimple(@"C:\Source", @"D:\Backup");
if (!result.Success) Console.WriteLine(result.Message);