Removing a file from a zip
BlitzMax Forums/BlitzMax Programming/Removing a file from a zip
| ||
Apparently in pub.zipengine (gman's module) when you add a stream/file to a zip it does not overwrite an already existing file of the same name. Does anyone know how to remove a file from a zip? |
| ||
You could just ... 1. unzip the whole set of files to memory banks 2. delete the unwanted file/memory bank 3. rezip and save with the new file In effect that's probably what any zip engine would be doing under the hood, to delete a file. |
| ||
That would take longer then necessary in most cases (large zip.) gman?! |
| ||
Technically you have to do this when delete a file inside zip. it actually does this: 1.Get document list/index from the end of the zip. 2.Copy the data to a new temp file and ignore the unnecessary part. 3.Rewrite file list/index at the end of temp zip file. 4.Delete the orignal zip file. 5.Rename the temp zip to the original file name. It's still pretty time-consuming on large zips, but still faster than solid archives(in the case you need to re-compress every bits). |
| ||
Bleh.. zipengine should still manage overwriting the current file though. |