Adding Additional Files in ZIP file

Adding Additional Files in ZIP file

  

Hi! Is it possible to add additional files when a zip file is already present.


Example:

I have a zip file with 10 .pdf files. I wanted to add more .pdf files inside. I tried downloading the zip file, use LoadZip then AddFiles, but it overwrites the existing files inside the zip.

Hi Clifford,

Looks like a bug. For know what you can do is get the files from zip and add them again

Regards,

Marcelo

Hi Clifford,

This is indeed the current behaviour, but it's not a bug as Marcelo suggests, it's by design - or rather, the current Zip Extension does not provide for adding files to an exisiting ZIP file. It's unfortunate the documentation (if there is any) doesn't explicitly state that.

As a workaround, you can indeed follow Marcelo's example, i.e. adding all the files after retrieving them, then add the new files. This is not very efficient, but currently the only way.

Hi Kilian,

Do you know why it was done like this by design? There is any technical challenge?

Regards,

Marcelo

Hi Marcelo,

Probably because it's the most straightforward design, given they use SharpZipLib. You need to do some extra stuff to modify an existing file, and you need to detect whether the current file is emtpy or not. Also, it might just be that wasn't possible with SharpLibZip when they started using it, and they haven't changed the interface since ages.

Hi Marcelo,


Yes indeed that is a good work around. I have tried it. However, for a much larger data do you think it is still possible? I have like 6000+ .PDF files to consolidate in a single zip file. I also tried using process (background process) but the server times-out at around 200th when I try to re-add the files. Any suggestions to increase the life of a process for it to finish the re-adding of files?


Thanks!

Hi Clifford,

If you're working with such big ZIP files, perhaps the BigZip Forge component might be of interest (disclaimer: I've never used it myself).

Hi Clifford,

I also did some tests with the component that Kilian mention and the addfile work when you load a zip. Since you need to add so many files to the zip what you can do is use a timer and add 100 files after that check if you still have more files to add and if yes launch the timer again. you can watch this https://www.outsystems.com/learn/courses/43/master-class-on-best-practices-and-timers/?StartCourse=False to understand what i mean.(if you only want to check the timers part go to 2h14m)

Regards,

Marcelo