Ebad Masood
Ebad Masood

Reputation: 2379

Create a file within a Zip file in C#

Is it possible to create a file within a Zip file?

Let's say I have a file abc.zip and want to create a file in it named SomeFile.txt. Is it possible? [I am using a dll Ionic.Zip which helps with Zip file manipulation]. Also, I want to do this without unzipping it.

Upvotes: 0

Views: 233

Answers (2)

Tilak
Tilak

Reputation: 30728

Working with Zip Files in .NET

Upvotes: 0

Jon
Jon

Reputation: 437834

Sure. For example, if you have already created SomeFile.txt:

using (var zip = ZipFile.Read("abc.zip"))
{
    zip.AddFile("SomeFile.txt");
    zip.Save();
}

Upvotes: 5

Related Questions