开发者

zip not Extracting to target directory

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜