如何在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 [ ^ ],

    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