请教如何避免ZipFile.ExtractToDirectory的IOException

directmemory directmemory 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
已知目标文件已存在(因为是已加载的驱动所以不可删除),使用ZipFile.ExtractToDirectory解压欲覆盖时总是跳出错误如下,请问有办法跳过这些文件吗?或者禁止这些错误信息在CMD下面显示。谢谢。

Write temp files to folder failed: System.IO.IOException: 文件“C:\Users\fred\AppData\Local\Temp\Ng32B5s3ZjGOoo0KxkwWDQKK\GlFlash_v1.17.fl”已经存在。
在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
在 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
在 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
在 System.IO.Compression.ZipFileExtensions.ExtractToFile(ZipArchiveEntry source, String destinationFileName, Boolean overwrite)
在 System.IO.Compression.ZipFileExtensions.ExtractToDirectory(ZipArchive source, String destinationDirectoryName)
在 System.IO.Compression.ZipFile.ExtractToDirectory(String sourceArchiveFileName, String destinationDirectoryName, Encoding entryNameEncoding)
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
directmemory
C# 111,129 成员 642,539 内容