简体   繁体   中英

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM