www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Request: Example for working with Zip files

reply Tyro[a.c.edwards] <no spam.com> writes:
I have a zip file of multiple zipfiles each containing files, folders, and
other zip files. I need to tunnel into the individual files buried in all
subarchives and folders in order to edit/insert/remove information. Ultimately
I'd like to do the work directly inside the zip file without having to
decompressing and recompressing the files. Request a demonstration of how to
accomplish this.

Any assistance, tango or phobos, is greatly appreciated.

Andrew
Apr 10 2008
next sibling parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
Zip files are pretty easy to work with.  You can find the spec on a site 
like wotsit.org.

Decompressing/recompressing is most likely necessary (although it can be 
done in memory.)  Obviously writing to a temporary directory is 
non-ideal.  Most likely you would read the central directory out of the 
archive, cache changes to that and new files, and then write out a new 
zip file from that.

Working with it in-memory is also possible but would cost more for big 
archives.

-[Unknown]


Tyro[a.c.edwards] wrote:
 I have a zip file of multiple zipfiles each containing files, folders, and
other zip files. I need to tunnel into the individual files buried in all
subarchives and folders in order to edit/insert/remove information. Ultimately
I'd like to do the work directly inside the zip file without having to
decompressing and recompressing the files. Request a demonstration of how to
accomplish this.
 
 Any assistance, tango or phobos, is greatly appreciated.
 
 Andrew
Apr 10 2008
prev sibling next sibling parent jcc7 <technocrat7 gmail.com> writes:
== Quote from Tyro[a.c.edwards] (no spam.com)'s article
 I have a zip file of multiple zipfiles each containing files, folders,
 and other zip files. I need to tunnel into the individual files buried
 in all subarchives and folders in order to edit/insert/remove
 information. Ultimately I'd like to do the work directly inside the
 zip file without having to decompressing and recompressing the files.
 Request a demonstration of how to accomplish this.

 Any assistance, tango or phobos, is greatly appreciated.

 Andrew
Did you look in the Tutorials project? http://www.dsource.org/projects/tutorials/wiki/StandardLibraryCategory There are some Phobos examples (D 1.x or earlier): * http://www.dsource.org/projects/tutorials/wiki/ZipExample * http://www.dsource.org/projects/tutorials/wiki/ZlibExample * http://www.dsource.org/projects/tutorials/wiki/UnzipUsingStdZipExample (They're old examples, but I think they should work with D 1.x. If they don't quite work with D 1.x, please either add a note to the wiki that they don't work with D 1.x or change the example if you know what to fix.) I hope that helps. I might be able to scare up a couple more examples from my code (I remember creating a program that output some simple .odt files, which are actually .zip files), but it's zip isn't something I've spent a lot of time with.
Apr 11 2008
prev sibling parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
"Tyro[a.c.edwards]" wrote
I have a zip file of multiple zipfiles each containing files, folders, and 
other zip files. I need to tunnel into the individual files buried in all 
subarchives and folders in order to edit/insert/remove information. 
Ultimately I'd like to do the work directly inside the zip file without 
having to decompressing and recompressing the files. Request a 
demonstration of how to accomplish this.

 Any assistance, tango or phobos, is greatly appreciated.
At least for tango, there is zip support in the VFS (virtual file system): http://www.dsource.org/projects/tango/docs/current/tango.io.vfs.ZipFolder.html here is some more info (not complete yet) on VFS: http://www.dsource.org/projects/tango/wiki/ChapterVFS -Steve
Apr 11 2008
parent Tower Ty <towerty msn.com.au> writes:
Steven Schveighoffer Wrote:


I went to that site amd I would like to read your page but Its pump up
terminoligy is confusing. I always like to see a simple introduction come first
in case the reader does not have your level of expertise .

In your pages' case something like this to start (if it is right) 

Tango can create a virtual file system which will combine the chosen true file
systems of your source in a way chosen by you. This can then be used more
easily as one cohesive file system  
The files can be from your hard drive , zip files , ftp or WebDAV systems

Remember the poor old dummies like me- now I'll go back and see if I can make
sence of a bit more of it .
Apr 11 2008