1

How to compress a file into zip format without having zip package installed? Pretty much what I need to do. I tried tar -czf loremipsum.zip but the format isn't a correct zip format when I try to uncompress it on windows. I'm limited and won't be able to install the package. Is there any work around?

DopeGhoti
  • 76,081

2 Answers2

4

A number of tools can create zip files, perhaps one of them will be available...

7-Zip can be used as follows:

7z a yourzip.zip files ...

Java’s JAR can also be used, as follows:

jar cMf yourzip.zip files ...

(the M option tells jar not to create a manifest).

You could also download zip and run that instead of relying on a copy installed on the system, it has hardly any dependencies:

wget ftp://ftp.info-zip.org/pub/infozip/unix/linux/unz551x-glibc.tgz ftp://ftp.info-zip.org/pub/infozip/unix/linux/zip23x-glibc.zip
tar xf unz551x-glibc.tgz unzip-5.51/unzip
unzip-5.51/unzip zip23x-glibc.zip zip

This will extract a zip binary which you can then use to create your zip file.

Stephen Kitt
  • 434,908
0

tar doesn't know how to handle PKZIP files. If you want to use tar, your options are "gzip" (z), "bzip2" (j), and "compress" (Z).

DopeGhoti
  • 76,081