This project has moved and is read-only. For the latest updates, please go here.

Deleteing files

Sep 16, 2009 at 4:05 PM
Hi,
 
Please forgive me if I am asking a stupid question but am I right in saying that in order to remove data (stored file / stream) from the zip file, I would have to create a new zip file and copy over the data (minus the deleted file). I can see this working for small files but for large zip files containing many files it's going to be very slow. Can you suggest an alternative?
Sep 16, 2009 at 4:36 PM

Hi dtubb,

Thanks for writting.

The intention of this library is to provide a very simple mechanism for applications to produce zipped outputs and eventually read them again. It is not a 100% featured library. Deletion can be done just as you described (write the zip again). Deleting a file without regenerating the zip file is possible but will be almost the same in terms of performance. At least you will need to:

  • Locate file position inside zip.
  • Copy all following files from its current position overwritting the deleted file data.
  • Rewrite all the central directory because file positions have been changed

This operation will represent, in best case, an average of 50% of time-savings w.r.t. the traditional way (write all file again).

Anyway, if you still find this library useful, please vote for it.

Thanks and best regards,

Jaime.

Sep 16, 2009 at 6:47 PM

ok thanks Jamie, and yes i have found this extremely useful.

thanks again

Dan

Sep 29, 2009 at 7:56 AM

Hi Dan,

I have released a new version with Remove capability, among other new features.

Best regards,

Jaime.