Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

minizip append to file

Tags:

c++

append

zip

zlib

I'm using Zlib's Minizip program. I am trying to add files to a current zip file. I found that I can append the zip file by using the function:

extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));

with append set to 2. However this does not overwrite files inside the zip instead it just keeps adding files to the end of the zip whether they already exist or not. Is there any way to fix this? I would like to have the option to replace only older files and/or overwrite all files.

like image 391
Megan Avatar asked Dec 01 '25 02:12

Megan


1 Answers

The minizip library does not currently support anything other than adding files to a zip archive. It does not support deleting or updating files in an archive either.

This quote from the minizip website may help you:

Ivan A. Krestinin wrote a small example of how delete a file from zip archive...

You can combine a delete operation with an add operation to achieve in-archive file replacement. The downside to the example code above is that it requires the creation of a temporary zip file on disk.

like image 175
Nathan Moinvaziri Avatar answered Dec 03 '25 17:12

Nathan Moinvaziri