如何在c#中使用相同的文件名在zip文件夹中添加文件名 [英] how to add file name in zip folder with same file name in c#

查看:129
本文介绍了如何在c#中使用相同的文件名在zip文件夹中添加文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在zip文件夹中添加相同的文件名。但是当我在zip.save中添加第二个文件时(responce.outputstream)。它给出了一个错误,因为相同的文件名已经存在。我该怎么做????

i want to add same file name in zip folder. but when i add 2nd file in zip.save(responce.outputstream). it gave an error thane same file name already exists.what should i do ????

推荐答案

会员10494762写道:
Member 10494762 wrote:

...请你提出任何建议我应该使用什么dll拉链,除了Ionic.Zip?

…can u please gave any suggestion what dll should i use for zip which are also capable of zip with the same file name apart from Ionic.Zip?

当然也能用拉链和相同的文件名。



Certainly.

  1. 您可以使用#ziplib:

    http://www.icsharpcode.net/opensource/sharpziplib/ [ ^ ]。
  2. 另一个选择是使用SevenZipSharp,一个着名的7-Zip的.NET包装器:

    http://en.wikipedia.org/wiki/7-Zip [ ^ ],

    http://sevenzipsharp.codeplex.com/ [ ^ ]。
  3. 另一个选项是SharpCompress,适用于多种压缩格式的完全原生.NET库:

    http://sharpcompress.codeplex.com [< a href =http://sharpcompress.codeplex.comtarget =_ blanktitle =New Window> ^ ],

    https://github.com/adamhathcock/sharpcompress [ ^ ]。
  1. You can use #ziplib:
    http://www.icsharpcode.net/opensource/sharpziplib/[^].
  2. Another option is using SevenZipSharp, a .NET wrapper of the famous 7-Zip:
    http://en.wikipedia.org/wiki/7-Zip[^],
    http://sevenzipsharp.codeplex.com/[^].
  3. Another option is SharpCompress, a fully native .NET library for several compression formats:
    http://sharpcompress.codeplex.com[^],
    https://github.com/adamhathcock/sharpcompress[^].





这三个选项都是开源的。我建议在你的解决方案中包含源项目。



祝你好运,新年快乐!



-SA


multipleFiles.AddFile(doc1, string.Empty);//here i user folder name on(string.Empty)..it will create directory and save file inside the directory

 multipleFiles.AddFile(doc1, "foldername"); //here it says file name already exists


这篇关于如何在c#中使用相同的文件名在zip文件夹中添加文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆