开发者

zip not Extracting to target directory

开发者 https://www.devze.com 2023-02-02 11:38 出处:网络
This is the code using (ZipFile zipnew = ZipFile.Read(strPath)) { foreach (ZipEntr开发者_JAVA百科y zenew in zipnew)

This is the code using (ZipFile zipnew = ZipFile.Read(strPath)) { foreach (ZipEntr开发者_JAVA百科y zenew in zipnew) { zenew.Extract(exPath); }

zenew.filename="c:\temp\images\fish2.jpg" exPath = "c:\temp\members\12\images"

I get this error The file C:\temp\Images\fish2.jpg already exists.

Hope to get a reply Thanks


It looks like you need to set the Overwrite flag to something. Here is an example:

using (ZipFile zipnew = ZipFile.Read(strPath)) { foreach (ZipEntry zenew in zipnew)        
   {
      zenew.filename="c:\temp\images\fish2.jpg"
      exPath = "c:\temp\members\12\images"
      zenew.Extract(exPath, ExtractExistingFileAction.OverwriteSilently);
   }
0

精彩评论

暂无评论...
验证码 换一张
取 消