[2008]Merge two .zip files?
Is it possible to merge to .zip files? I know text files and mp3 files can be merged. I have searched around and some people say I need to know the binary setup of the file in order to merge it. Would it be possible to create a new file as big as the two files combined and then make a byte for byte copy of the files into the larger one?
Re: [2008]Merge two .zip files?
You wouldn't be able to do that with most file formats and certainly not with ZIP files. Most files have headers that describe the file type and various aspects of the file contents. A ZIP file is no exception. If you did what you suggest then you'd end up with a single file with two sets of headers, one of them in the wrong place and neither of them describing the file contents accurately.
The .NET Framework has no native support for the ZIP file format. Java does have such support, so you were able to use the J# redistributable in previous versions. VS 2008 doesn't include J# though, as it has been discontinued.
You would need to use some third-party component that does support the ZIP file format. If the component works at a high-level then it may have a function that will merge two files for you. If it works at a low level then you would have to open both files yourself. You'd then either read the entries from one file and write them to the other then delete the file you read from, or else create a new file and read the contents of each existing file and write them both to the new.
I'm fairly certain that any high-level component would be commercial. SharpZipLib is a free, open-source component that works at a low level. Older versions didn't support writing new entries to an existing file but I think the latest version does.
Re: [2008]Merge two .zip files?
Also, you can look into:
http://www.picozip.com/
It seems to have the functionality of merging zip files among other operations. Perhaps you can look into the libraries that they used.