Questions tagged [dotnetzip]

Questions dealing with the DotNetZip open-source zip library for .NET

DotNetZip is an open source zip library. DotNetZip works on PCs with the full .NET Framework, and also runs on mobile devices that use the .NET Compact Framework. Silverlight is also supported.

Below is an example of using the library with C#:

 using (ZipFile zip = new ZipFile())
 {
     // add this map file into the "images" directory in the zip archive
     zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images");
     // add the report into a different directory in the archive
     zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files");
     zip.AddFile("ReadMe.txt");
     zip.Save("MyZipFile.zip");
 }

Note: Just for reference the project builds into Ionic.Zip.dll

Installation

DotNetZip can most easily be installed through its NuGet package.

Install-Package DotNetZip
460 questions
5
votes
2 answers

Using memorystream and DotNetZip in MVC gives "Cannot access a closed Stream"

I'm trying to create a zipfile in a MVC method using the DotNetZip components. Here is my code: public FileResult DownloadImagefilesAsZip() { using (var memoryStream = new MemoryStream()) { using (var zip = new…
Frode Lillerud
  • 7,324
  • 17
  • 58
  • 69
5
votes
1 answer

Getting a "Cannot Read That as a Zip File" Exception while trying to get a stream from an Inner Zip File (a Zip within another Zip)

In C#, I'm using the DotNetZip I have a zip called "innerZip.zip" which contains some data, and another zip called "outerZip.zip" which contains the innerZip. why am i doing it like this ? well, when setting the password, the password actually…
vexe
  • 5,433
  • 12
  • 52
  • 81
5
votes
1 answer

DotNetZip: Convert ZipFile to byte[] array

I'm using DotNetZip to add a file to a zip archive, which I've read from the file system. I'd like to convert the resulting ZipFile to byte[] array. Any assistance will be highly appreciated. My code is shown below. public byte[]…
okello
  • 601
  • 10
  • 27
4
votes
4 answers

How can I delete a directory in a Zip file using .NET?

How would I delete a directory in a .zip and all the files in it (preferably using DotNetZip)? Right now I'm running through all the files in the zip, but it doesn't work: foreach (ZipEntry e in zip) { //If the file is in the directory I want to…
Chris
  • 127
  • 1
  • 3
  • 8
4
votes
2 answers

DotNetZip: Add Files to Dynamically Created Archive Directory

I can't imagine this is hard to do, but I haven't been able to get it to work. I have a files class that just stores the location, directory, and name of the files I want to zip. The files I'm zipping exist on disk so the FileLocation is the full…
StronglyTyped
  • 2,134
  • 5
  • 28
  • 48
4
votes
2 answers

DotNetZip library "Access to the path denied"

I am trying to create a zip file and save it using DotNetZip library in ASP.NET application. But for some reason i get a Access to the path is denied error when i try to save it. I changed the TempFileFolder to another folder and have given…
Naveen
  • 315
  • 2
  • 4
  • 15
4
votes
3 answers

VB.NET - download zip in Memory and extract file from memory to disk

I'm having some trouble with this, despite finding examples. I think it may be an encoding problem, but I'm just not sure. I am trying to programitally download a file from a https server, that uses cookies (and hence I'm using httpwebrequest). I'm…
Mark
  • 61
  • 1
  • 6
4
votes
1 answer

Extracting zip file in memory failing with C# DotNetZip

I'm trying to download and extract a zip file in C#, specifically DotNetZip. When I run this code... HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(reportUrl); HttpWebResponse response =…
Charles Offenbacher
  • 3,094
  • 3
  • 31
  • 38
4
votes
2 answers

DotNetZip does not extract Best compression from WinZip

I have created a very simple program in C# using the DotNetZip dll. I am trying to extract a zip file that chooses the best compression. Here is the code. static void Main(string[] args) { string nameOfFile = "testBest.zip"; …
Mr. Ant
  • 700
  • 2
  • 15
  • 32
4
votes
2 answers

Using DotnetZip with Visual Studio C++/CLR

I tried to use DotNetZip with C++/CLR But I found everyfile i downloaded contain no .h file, in the example code, there is "using namespace Ionic::Zip;" How can I get that to work in my code?
r1cebank
  • 345
  • 1
  • 3
  • 12
4
votes
3 answers

Compression issue with large archive of files in DotNetZip

Greetings.... I am writing a backup program in c# 3.5, using hte latest DotNetZip. The basics of the program is to be given a location on a server and the max size of a spanned zip file and go. From there it should traverse all the folder/files…
David
  • 43
  • 1
  • 3
4
votes
2 answers

Extracting a specific folder from a zip using DotNetZip

I've searched around for examples, but can't seem to find a DotNetZip scenario that involves extracting a certain folder. I'm trying to extract a folder called "CSS" from a .zip file, and it is a top-level folder inside the .zip file. This is the…
Grahame A
  • 3,903
  • 12
  • 46
  • 70
4
votes
1 answer

How to zip the multiple files into the folder until condition is met?

Technology Used: C#, IonicZip library. From the list of multiple log files(Let's say 10,000, each of reasonable amount of size). I have to zip these files in a folder. But then zipped folder's size must be approximately under 4MB. How can I have…
Avishekh Bharati
  • 1,858
  • 4
  • 27
  • 44
4
votes
4 answers

Remove DLL dependency for an Application

In my application, I need to Zip and Unzip some files. For that I have used DotNet Zip Library (Ionic.Zip.dll-- DotNet Zip Lib ) Everything works fine but when I take EXE of my file and try to run it from different folder, it fails to run. I have to…
Swanand
  • 4,027
  • 10
  • 41
  • 69
4
votes
3 answers

Not able to properly download files from azure storage and data are lost too when downloading files

I have 2 files saved on Azure blob storage: Abc.txt Pqr.docx Now i want to create zip files of this 2 files and allow user to download. I have saved this in my database table field like this: Document Abc,Pqr Now when i click on download then i…