Home Explore Blog CI



man-pages

28th chunk of `zip.man`
b2e73f99ee4dc31a3f6146bbc2abe6eb91526d51b4e517580000000100000fc1
 the  speed  of compression using the specified digit #,
              where -0 indicates no compression (store all files), -1 indicates
              the fastest compression speed (less compression) and -9 indicates
              the slowest compression speed (optimal compression,  ignores  the
              suffix list). The default compression level is -6.

              Though  still  being  worked,  the intention is this setting will
              control compression speed for all compression methods.  Currently
              only deflation is controlled.

       -!
       --use-privileges
              [WIN32] Use privileges (if granted)  to  obtain  all  aspects  of
              WinNT security.

       -@
       --names-stdin
              Take  the list of input files from standard input. Only one file‐
              name per line.

       -$
       --volume-label
              [MSDOS, OS/2, WIN32] Include the volume label for the drive hold‐
              ing the first file to be compressed.  If you want to include only
              the volume label or to force a specific drive, use the drive name
              as first file name, as in:

                     zip ‐$ foo a: c:bar

EXAMPLES
       The simplest example:

              zip stuff *

       creates the archive stuff.zip (assuming it does not exist) and puts  all
       the  files  in the current directory in it, in compressed form (the .zip
       suffix is added automatically, unless the archive name  contains  a  dot
       already; this allows the explicit specification of other suffixes).

       Because  of  the way the shell on Unix does filename substitution, files
       starting with "." are not included; to include these as well:

              zip stuff .* *

       Even this will not include any subdirectories from  the  current  direc‐
       tory.

       To zip up an entire directory, the command:

              zip ‐r foo foo

       creates the archive foo.zip, containing all the files and directories in
       the directory foo that is contained within the current directory.

       You may want to make a zip archive that contains the files in foo, with‐
       out  recording  the  directory  name, foo.  You can use the -j option to
       leave off the paths, as in:

              zip ‐j foo foo/*

       If you are short on disk space, you might not have enough room  to  hold
       both  the  original  directory  and  the  corresponding  compressed  zip
       archive.  In this case, you can create the archive in steps using the -m
       option.  If foo contains the subdirectories tom, dick,  and  harry,  you
       can:

              zip ‐rm foo foo/tom
              zip ‐rm foo foo/dick
              zip ‐rm foo foo/harry

       where the first command creates foo.zip, and the next two add to it.  At
       the completion of each zip command, the last created archive is deleted,
       making room for the next zip command to function.

       Use  -s  to  set the split size and create a split archive.  The size is
       given as a number followed optionally by one of k (kB), m (MB), g  (GB),
       or t (TB).  The command

              zip ‐s 2g ‐r split.zip foo

       creates  a split archive of the directory foo with splits no bigger than
       2 GB each.  If foo contained 5 GB of  contents  and  the  contents  were
       stored  in  the  split archive without compression (to make this example
       simple), this would create three splits, split.z01 at 2 GB, split.z02 at
       2 GB, and split.zip at a little over 1 GB.

       The -sp option can be used to pause zip between splits to allow changing
       removable media, for example, but read the descriptions and warnings for
       both -s and -sp below.

       Though zip does not update split archives, zip provides the  new  option
       -O  (--output-file) to allow split archives to be updated and saved in a
       new archive.  For example,

              zip inarchive.zip

Title: zip Options (cont.) and Examples
Summary
This section continues the description of zip options with '-#' for setting compression speed, '-!' for using WinNT security privileges (Windows only), '-@' for reading input files from standard input, and '-$' for including the volume label (MSDOS, OS/2, WIN32). The section concludes with several practical examples of using the zip command to create archives, add files, handle directories, create split archives and use the output-file option to update split archives.