Home Explore Blog CI



man-pages

2nd chunk of `zip.man`
b0421eccd3f3db9b8edab1681ea5b75cc0075715023914ef0000000100000fb8
 option may not be compat‐
       ible with PKZIP as data descriptors are used and PKZIP at  the  time  of
       this  writing  does  not support data descriptors (but recent changes in
       the PKWare published zip standard now include some support for the  data
       descriptor format zip uses).

       Mac OS X.  Though previous Mac versions had their own zip port, zip sup‐
       ports  Mac  OS  X as part of the Unix port and most Unix features apply.
       References to "MacOS" below generally refer to MacOS versions older than
       OS X.  Support for some Mac OS features in the Unix Mac OS X port,  such
       as resource forks, is expected in the next zip release.

       For a brief help on zip and unzip, run each without specifying any para‐
       meters on the command line.

USE
       The program is useful for packaging a set of files for distribution; for
       archiving  files;  and  for saving disk space by temporarily compressing
       unused files or directories.

       The zip program puts one or more compressed  files  into  a  single  zip
       archive,  along with information about the files (name, path, date, time
       of last modification, protection, and check information to  verify  file
       integrity).   An  entire  directory  structure  can be packed into a zip
       archive with a single command.  Compression ratios of  2:1  to  3:1  are
       common  for  text files.  zip has one compression method (deflation) and
       can also store files without compression.  (If bzip2 support  is  added,
       zip  can also compress using bzip2 compression, but such entries require
       a reasonably modern unzip to decompress.  When bzip2 compression is  se‐
       lected, it replaces deflation as the default method.)  zip automatically
       chooses  the  better  of the two (deflation or store or, if bzip2 is se‐
       lected, bzip2 or store) for each file to be compressed.

       Command format.  The basic command format is

              zip options archive inpath inpath ...

       where archive is a new or existing zip archive and inpath is a directory
       or file path optionally including wildcards.  When given the name of  an
       existing  zip archive, zip will replace identically named entries in the
       zip archive (matching the relative names as stored in  the  archive)  or
       add  entries for new names.  For example, if foo.zip exists and contains
       foo/file1 and foo/file2,  and  the  directory  foo  contains  the  files
       foo/file1 and foo/file3, then:

              zip ‐r foo.zip foo

       or more concisely

              zip ‐r foo foo

       will  replace  foo/file1 in foo.zip and add foo/file3 to foo.zip.  After
       this,  foo.zip  contains  foo/file1,  foo/file2,  and  foo/file3,   with
       foo/file2 unchanged from before.

       So if before the zip command is executed foo.zip has:

               foo/file1 foo/file2

       and directory foo has:

               file1 file3

       then foo.zip will have:

               foo/file1 foo/file2 foo/file3

       where foo/file1 is replaced and foo/file3 is new.

       -@ file lists.   If  a  file list is specified as -@ [Not on MacOS], zip
       takes the list of input files from standard input instead  of  from  the
       command line.  For example,

              zip ‐@ foo

       will store the files listed one per line on stdin in foo.zip.

       Under  Unix,  this  option can be used to powerful effect in conjunction
       with the find (1) command.  For example, to archive  all  the  C  source
       files in the current directory and its subdirectories:

              find . ‐name "*.[ch]" ‐print | zip source ‐@

       (note  that  the pattern must be quoted to keep the shell from expanding
       it).

       Streaming input and output.  zip will also accept a single dash ("‐") as
       the zip file name, in which case it will write the zip file to  standard
       output,

Title: zip: Compatibility, Usage, and Command Format
Summary
This section discusses the compatibility of zip with PKZIP, particularly regarding data descriptors and the use of the pause option. It also covers Mac OS X support and provides instructions on how to get brief help on zip and unzip. Furthermore, it explains the utility of zip for file distribution, archiving, and disk space saving. The command format, including the use of wildcards and file lists via standard input, is detailed with examples.