Creating zip file dynamically

Creating zip file dynamically

Post by Alex Tan » Tue, 09 May 2000 04:00:00

Hi folks.

I would like to be able to create a zip file on the fly using some static
and some dynamic data.

The zip file would have the following characteristics:

  * There are three static files (the content of these files rarely
    changes, therefore the files will reside somewhere on a filesystem

  * There is one file which is created dynamically by a program.  

I've tried using the info-zip "zip" program with the "-" parameter such

    myprog | zip static1.txt static2.txt static3.txt -

This will create the zip file, however the input generated from myprog
gets inserted into the zip file with the name "-".  I'd like to be able to
give this file a name so that the user who is uncompressing the file will
have a descriptive filename.  

Is it possible using the info-zip "zip" program to give stdin a name?  

lastly, I'd like to be able to do this without shelling it out to zip, is
there a way to do this in perl using the "Compress::Zlib" library?  





1. Creating INDIVIDUAL zip files of many INDIVIDUAL files.

        I want to compress a LOT of big files into INDIVIDUAL zip files.
Say I have these files on disk a:\


        And I would thus want to create the files, BLOT.ZIP, STEP.ZIP, TRIP.ZIP
        I wrote the following batch file to ATTEMPT to do this:

 echo -
 echo mzip: a batch file to zip multiple files individually
 echo -
 echo USAGE: mzip x y z
 echo             x: disk/directory (a:\)
 echo             y: filename (before extender- wildcards allowed)
 echo             z: extender
 echo -

for %%a in (%1%2.%3) do goto ziploop
 goto done

 pkzip c:\outgoing\ %1%2.%3


        If I type "mzip a:\ trip flo" the program zips TRIP.FLO and sticks it
in the outgoing directory.  Perfect.  But if I type "mzip a:\ * flo" pkzip
says "can't create file '/outgoing/*.zip'"
        I know why this happens, but I don't know how to get around it.
        How do I get a batch file to pass the part of the input filename before
the period to pkzip?  Is it even possible with batch files?

"My mom bought me a cool shirt; when I wear it I'm the shit.
 I'm not really that legit- my mom... bought... it." -Ween

2. Upside Down

3. Dynamically created PDF files

4. Stylewriter ROM

5. dynamically create a folder and a file

6. help: call waiting and 14.4k

7. FW: dynamically create a folder and a file

8. Should I Buy A Refurbished Laptop?

9. print dynamically a text from the pdf file and hide text dynamically

10. Another encrypted zip file problem - Zip file experts please

11. Original Date & time in a zip file created with pkzip 2.04

12. Zlib for creating PK format zip files?

13. creating zip files programmatically