Adding to a windows zip file without zip.exe

Brian Dessent
Wed May 16 20:06:00 GMT 2007

Chadwick wrote:

> Updating the servers with new cygwin or command line packages is not an
> option at this point.
> That being said, I am a huge cygwin fan and am not willing to give up on a
> shell script as my solution quite yet.
> The cygwin version on the servers does have gzip, gunzip, bzip2, bunzip2,
> and unzip.
> Unfortunatly I have as yet been unsucceful in using these tools to add a
> file to my windows zip archive.

Don't make the mistake of assuming that gzip or bzip2 have anything to
do with the .zip file format.  They don't, and are totally separate, so
those commands will be useless for your purposes.  And I don't think
there is any conceivable way of creating/updating an archive with unzip.

I don't see any reason (other than policy) why you can't just have your
script copy zip.exe into /usr/bin and then use it.  It is completely
standalone, depending on nothing but the Cygwin DLL:

$ cygcheck /usr/bin/zip

If policy is the reason, then just have your script copy zip.exe to /tmp
and then unlink it when it's done.  Heck, if it had to the script could
contain a uuencoded copy of zip.exe internally (it's only 64 kB in size)
which is temporarily extracted and then deleted.

You could do this with Perl and Archive::Zip, however this module is not
included in the main Perl bundle, so you'd have to install it first, and
if you can't install a simple and standard 64 kB binary in /usr/bin I
don't see how you're going to install perl modules.

I feel that any other solution is going to be a lot more work than just
arranging to run zip.exe somehow.


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list