home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / ZIP10X.ZIP / ZIP.DOC < prev    next >
Text File  |  1991-10-03  |  24KB  |  595 lines

  1.  
  2.  
  3.  
  4. ZIP(1)              UNIX Programmer's Manual               ZIP(1)
  5.  
  6.  
  7.  
  8. NAME
  9.      zip - package and compress (archive) files
  10.  
  11. SYNOPSIS
  12.      zip [ -cdefghijklmnoqrsuwyz ] [ -b path ] [ -t mmddyy ] zip-
  13.      file list [ -x list ]
  14.  
  15. DESCRIPTION
  16.      Zip is a compression and file packaging utility for Unix,
  17.      MSDOS, OS/2, and VMS.  It is analogous to a combination of
  18.      tar and compress and is compatible with PKZIP (Phil Katz
  19.      ZIP) for MSDOS systems.
  20.  
  21.      There is a companion to Zip called UnZip (of course) which
  22.      you should be able to find the same place you got Zip. Zip
  23.      and UnZip can work with files produced by PKZIP under MSDOS,
  24.      and PKZIP and PKUNZIP can work with files produced by Zip.
  25.  
  26.      Zip puts one or more compressed files into a single "zip
  27.      file" along with information about the files, including the
  28.      name, path if requested, date and time last modified, pro-
  29.      tection, and check information to verify the fidelity of
  30.      each entry.  Zip can pack an entire directory structure in a
  31.      zip file with a single command.  Compression ratios of 2:1
  32.      to 3:1 are common for text files.  Zip has two compression
  33.      methods, implosion and shrinking, and automatically chooses
  34.      the better of the two for each file to be compressed.
  35.  
  36.      Zip is useful for packaging a set of files to send to some-
  37.      one or for distribution; for archiving or backing up files;
  38.      and for saving disk space by temporarily compressing unused
  39.      files or directories.
  40.  
  41. HOW TO INSTALL ZIP
  42.      Zip is distributed as C source code that can be compiled on
  43.      a wide range of Unix machines, VAXes running VMS, and MSDOS
  44.      machines using Microsoft or Borland C++, and OS/2 machines
  45.      using Microsoft C.  You will need Unzip (under Unix, MSDOS,
  46.      or VMS) or PKUNZIP (under MSDOS) to unpack the distribution
  47.      file, zip10.zip.
  48.  
  49.      First, unpack the source as follows, assuming that you have
  50.      zip10.zip in the current directory:
  51.  
  52.           mkdir zipsrc
  53.           cd zipsrc
  54.           unzip ../zip10
  55.  
  56.      This extracts all source files and documentation in the
  57.      directory called "zipsrc". You then do:
  58.  
  59.  
  60.           make system
  61.  
  62.      where "system" is one of: bsd, bsdold, sysv, next, next10,
  63.      sun, hpux, dnix, cray, 3b1, zilog, aux, convex, aix, or
  64.      minix.  If you are using a NeXT running version 2.0 or
  65.      greater, then make next.  If you are using 1.0, then make
  66.      next10.  If you are using Sun OS 4.x, then make sun.  If you
  67.      are using HPUX, then make hpux.  The other special systems
  68.      are DNIX 5.2 or 5.3, Cray Unicos, AT&T 3B1 (also known as
  69.      Unix PC or PC 7300), Zilog Zeus, A/UX, Convex, AIX, and
  70.      MINIX.  Otherwise, if you are using BSD Unix, try bsd.  If
  71.      the linker cannot find _memset or _memcpy, try bsdold.  If
  72.      you are using System V Unix or SCO Unix, try sysv.  Also use
  73.      sysv on a Silicon Graphics (SGI) machine.  You can also
  74.      cross-compile Zip for MSDOS under SCO 386 Unix using "make
  75.      scodos".
  76.  
  77.      If none of these compiles, links, and functions properly on
  78.      your Unix system, see the section BUGS below for how to get
  79.      help.
  80.  
  81.      If the appropriate system was selected, then the executable
  82.      "zip" will be created.  You can move the executable "zip" to
  83.      an appropriate directory in the search path using a command
  84.      like:
  85.  
  86.           mv zip ~/bin
  87.  
  88.      or
  89.  
  90.           mv zip /usr/local/bin
  91.  
  92.      You can use the command "set" to see the current search
  93.      path.  If you are using the C-Shell (csh), enter the com-
  94.      mand:
  95.  
  96.           rehash
  97.  
  98.      so csh can find the new command in the path.  You are now
  99.      ready to use Zip.
  100.  
  101.      You can also move the manual page (the raw form of what
  102.      you're reading) to where the Unix man command can find it
  103.      (assuming you have the necessary privileges):
  104.  
  105.           mv zip.1 /usr/man/man1
  106.  
  107.      You can get rid of the now unnecessary source and object
  108.      files with:
  109.  
  110.           cd ..
  111.           rm -r zipsrc
  112.  
  113.      This will remove the directory zip and its contents created
  114.      by unzip.  You should keep the zip10.zip file around though,
  115.      in case you need to build it again or want to give it to a
  116.      colleague.
  117.  
  118.      The steps for installation under MSDOS, OS/2, and VMS are
  119.      similar to the above: first unzip the distribution files
  120.      into their own directory.  Then under MSDOS do one of:
  121.  
  122.           make makefile.msc
  123.           make -fmakefile.bor
  124.  
  125.  
  126.      for Microsoft or Borland C++, respectively.  Under OS/2:
  127.  
  128.           nmake -f makefile.os2
  129.  
  130.      for Microsoft C 6.00.  Under VAX VMS:
  131.  
  132.  
  133.           @makevms
  134.  
  135.      The installation process will also compile and link several
  136.      other utilities.  They are zipcloak for encrypting and
  137.      decrypting zip files, zipnote for editing zip file comments,
  138.      zipsplit for splitting a zip file into several zip files,
  139.      and ship for sending zip files or any other binary file via
  140.      electronic mail.  For command help on any of the zip* utili-
  141.      ties, simply enter the name with no arguments.  For help
  142.      with ship, enter "ship -h".
  143.  
  144. HOW TO USE ZIP
  145.      The simplest use of Zip is as follows:
  146.  
  147.           zip stuff *
  148.  
  149.      This will create the file "stuff.zip" (assuming it does not
  150.      exist) and put all the files in the current directory in
  151.      stuff.zip in a compressed form.  The .zip suffix is added
  152.      automatically, unless that file name given contains a dot
  153.      already.  This allows specifying suffixes other than ".zip".
  154.  
  155.      Because of the way the shell does filename substitution,
  156.      files that start with a "." are not included.  To include
  157.      those as well, you can:
  158.  
  159.           zip stuff .* *
  160.  
  161.      Even this will not include any subdirectories that are in
  162.      the current directory.  To zip up an entire directory, the
  163.      command:
  164.  
  165.           zip -r foo foo
  166.  
  167.      will create the file "foo.zip" containing all the files and
  168.      directories in the directory "foo" that is in the current
  169.      directory.  The "r" option means recurse through the direc-
  170.      tory structure.  In this case, all the files and directories
  171.      in foo are zipped, including the ones that start with a ".",
  172.      since the recursion does not use the shell's file-name sub-
  173.      stitution.  You should not use -r with the name ".*", since
  174.      that matches ".." which will attempt to zip up the parent
  175.      directory--probably not what was intended.
  176.  
  177.      You may want to make a zip file that contains the files in
  178.      foo, but not record the directory name, foo.  You can use
  179.      the -j (junk path) option to leave off the path:
  180.  
  181.           zip -j foo foo/*
  182.  
  183.      The -y option (only under Unix) will store symbolic links as
  184.      such in the zip file, instead of compressing and storing the
  185.      file referred to in the link.
  186.  
  187.      You might be zipping to save disk space, in which case you
  188.      could:
  189.  
  190.           zip -rm foo foo
  191.  
  192.      where the "m" option means "move".  This will delete foo and
  193.      its contents after making foo.zip.  No deletions will be
  194.      done until the zip has completed with no errors.  This
  195.      option is obviously more dangerous and should be used with
  196.      care.
  197.  
  198.  
  199.      If the zip file already exists, these commands will replace
  200.      existing or add new entries to the zip file.  For example,
  201.      if you were really short on disk space, you might not have
  202.      enough room simultaneously to hold the directory foo and the
  203.      compressed foo.zip.  In this case, you could do it in steps.
  204.      If foo contained the subdirectories tom, dick, and harry,
  205.      then you could:
  206.  
  207.           zip -rm foo foo/tom
  208.           zip -rm foo foo/dick
  209.           zip -rm foo foo/harry
  210.  
  211.      where the first command would create foo.zip, and the next
  212.      two would add to it.  At the completion of each zip command,
  213.      the directory just zipped would be deleted, making room in
  214.      which the next Zip command could work.
  215.  
  216. MODIFYING EXISTING ZIP FILES
  217.      When given the name of an existing zip file with the above
  218.      commands, Zip will replace identically named entries in the
  219.      Zip file or add entries for new names.  For example, if
  220.      foo.zip exists and contains foo/file1 and foo/file2, and the
  221.      directory foo contains the files foo/file1 and foo/file3,
  222.      then:
  223.  
  224.           zip -r foo foo
  225.  
  226.      will replace foo/file1 in foo.zip and add foo/file3 to
  227.      foo.zip.  After this, foo.zip contains foo/file1, foo/file2,
  228.      and foo/file3, with foo/file2 unchanged from before.
  229.  
  230.      When changing an existing zip file, Zip will write a tem-
  231.      porary file with the new contents, and only replace the old
  232.      one when the zip has completed with no errors.  Also, the
  233.      two methods, shrink and implode, create temporary files that
  234.      are deleted after each file is zipped.  You can use the -b
  235.      option to specify a different path (usually a different dev-
  236.      ice) to put the temporary files in.  For example:
  237.  
  238.           zip -b /tmp stuff *
  239.  
  240.      will put the temporary zip file and the temporary compres-
  241.      sion files in the directory "/tmp", copying over stuff.zip
  242.      in the current directory when done.
  243.  
  244.      If you are only adding entries to a zip file, not replacing,
  245.      and the -g option is given, then Zip grows (appends to) the
  246.      file instead of copying it.  The danger of this is that if
  247.      the operation fails, the original zip file is corrupted and
  248.      lost.
  249.  
  250.      There are two other ways to change or add entries in a zip
  251.      file that are restrictions of simple addition or replace-
  252.      ment.  The first is -u (update) which will add new entries
  253.      to the zip file as before but will replace existing entries
  254.      only if the modified date of the file is more recent than
  255.      the date recorded for that name in the zip file.  For exam-
  256.      ple:
  257.  
  258.           zip -u stuff *
  259.  
  260.      will add any new files in the current directory, and update
  261.      any changed files in the zip file stuff.zip.  Note that Zip
  262.      will not try to pack stuff.zip into itself when you do this.
  263.      Zip will always exclude the zip file from the files on which
  264.      to be operated.
  265.  
  266.      The second restriction is -f (freshen) which, like update,
  267.      will only replace entries with newer files; unlike update,
  268.      will not add files that are not already in the zip file.
  269.      For this option, you may want to simply freshen all of the
  270.      files that are in the specified zip file.  To do this you
  271.      would simply:
  272.  
  273.           zip -f foo
  274.  
  275.      Note that the -f option with no arguments freshens all the
  276.      entries in the zip file.  The same is true of -u, and hence
  277.      "zip -u foo" and "zip -f foo" both do the same thing.
  278.  
  279.      This command should be run from the same directory from
  280.      which the original zip command was run, since paths stored
  281.      in zip files are always relative.
  282.  
  283.      Another restriction that can be used with adding, updating,
  284.      or freshening is -t (time), which will not operate on files
  285.      modified earlier than the specified date.  For example:
  286.  
  287.           zip -rt 120791 infamy foo
  288.  
  289.      will add all the files in foo and its subdirectories that
  290.      were last modified on December 7, 1991, or later to the zip
  291.      file infamy.zip.
  292.  
  293.      Also, files can be explicitly excluded using the -x option:
  294.  
  295.           zip -r foo foo -x \*.o
  296.  
  297.      which will zip up the contents of foo into foo.zip but
  298.      exclude all the files that end in ".o".  Here the backslash
  299.      causes Zip to match file names that were found when foo was
  300.      searched.
  301.  
  302.      The last operation is -d (delete) which will remove entries
  303.      from a zip file.  An example might be:
  304.  
  305.           zip -d foo foo/tom/junk foo/harry/\* \*.o
  306.  
  307.      which will remove the entry foo/tom/junk, all of the files
  308.      that start with "foo/harry/", and all of the files that end
  309.      with ".o" (in any path).  Note that once again, the shell
  310.      expansion has been inhibited with backslashes, so that Zip
  311.      can see the asterisks. Zip can then match on the contents of
  312.      the zip file instead of the contents of the current direc-
  313.      tory.
  314.  
  315.      Under MSDOS, -d is case sensitive when it matches names in
  316.      the zip file.  This allows deleting names that were zipped
  317.      on other systems, but requires that the names be entered in
  318.      upper case if they were zipped on an MSDOS system, so that
  319.      the names can be found in the zip file and deleted.
  320.  
  321. MORE OPTIONS
  322.      As mentioned before, Zip will use the best of two methods:
  323.      shrink or implode.  Usually implode is better, but sometimes
  324.      shrink is better, especially for smaller files.  Sometimes
  325.      neither method produces a packed version smaller than the
  326.      original file, in which case it is stored in the zip file
  327.      with no compression (called the "store" method).
  328.  
  329.      The option -s (shrink) will force Zip always to use shrink
  330.      or store, and the -i (implode) option forces Zip to use
  331.      implode or store.  Shrinking is faster than imploding, and
  332.      so -s might be used when speed is more important than
  333.      optimal compression.  Implode only (-i) might be used when
  334.      the unzipper for which the zip file is destined can only
  335.      handle implosion.  An example of this is the PKSFXjr program
  336.      that comes with PKZIP.  Also, -i is slightly faster than
  337.      imploding and shrinking at the same time.  For example:
  338.  
  339.           zip -rs foo foo
  340.  
  341.      will zip up the directory foo into foo.zip using only shrink
  342.      or store.  The speed of implosion can also be controlled
  343.      with options -0 (fastest method but less compression) to -9
  344.      (best compression but slower). The default value is -5. For
  345.      example:
  346.  
  347.           zip -r0 foo foo
  348.  
  349.      In nearly all cases, a file that is already compressed can-
  350.      not be compressed further by Zip, or if it can, the effect
  351.      is minimal.  The -n option prevents Zip from trying to
  352.      compress files that have the suffixes: .Z, .zip, .zoo, or
  353.      .arc.  Such files are simply stored (0% compression) in the
  354.      output zip file, so that Zip doesn't waste its time trying
  355.      to compress them.  If the environment variable NOZIP is set,
  356.      then the suffixes listed there are used instead of the
  357.      default list.  The suffixes are separated by either colons
  358.      or semicolons.  For example, in Unix csh:
  359.  
  360.           setenv NOZIP .Z:.zip:.tiff:.gif:.snd
  361.           zip -rn foo foo
  362.  
  363.      will put everything in foo into foo.zip, but will store any
  364.      files that end in .Z, .zip, .tiff, .gif, or .snd without
  365.      trying to compress them.  (Image and sound files often have
  366.      their own specialized compression methods.)  If the environ-
  367.      ment variable NOZIP exists but is empty or contains just a
  368.      colon or semicolon, then zip -n will store all the entries
  369.      and do no compression.
  370.  
  371.      Under Unix and under OS/2 (if files from a HPFS are stored),
  372.      Zip will store the full path (relative to the current path)
  373.      and name of the file (or just the name if -j is specified)
  374.      in the zip file along with the Unix attributes, and it will
  375.      mark the entry as made under Unix.  If the zip file is
  376.      intended for PKUNZIP under MSDOS, then the -k (Katz) option
  377.      should be used to attempt to convert the names and paths to
  378.      conform to MSDOS, store only the MSDOS attribute (just the
  379.      user write attribute from Unix), and mark the entry as made
  380.      under MSDOS (even though it wasn't).
  381.  
  382.      The -o (older) option will set the "last modified" time of
  383.      the zip file to the latest "last modified" time of the
  384.      entries in the zip file.  This can be used without any other
  385.      operations, if desired.  For example:
  386.  
  387.           zip -o foo
  388.  
  389.  
  390.      will change the last modified time of foo.zip to the latest
  391.      time of the entries in foo.zip.
  392.  
  393.      The -e and -c options operate on all files updated or added
  394.      to the zip file.  Encryption (-e) will prompt for a password
  395.      on the terminal and will not echo the password as it is
  396.      typed (if stderr is not a TTY, Zip will exit with an error).
  397.      New zip entries will be encrypted using that password.  For
  398.      added peace of mind, you can use -ee, which will prompt for
  399.      the password twice, checking that the two are the same
  400.      before using it.
  401.  
  402.      One-line comments can be added for each file with the -c
  403.      option.  The zip file operations (adding or updating) will
  404.      be done first, and you will then be prompted for a one-line
  405.      comment for each file.  You can then enter the comment fol-
  406.      lowed by return, or just return for no comment.
  407.  
  408.      The -z option will prompt you for a multi-line comment for
  409.      the entire zip file.  This option can be used by itself, or
  410.      in combination with other options.  The comment is ended by
  411.      a line containing just a period, or an end of file condition
  412.      (^D on Unix, ^Z on MSDOS, OS/2, and VAX/VMS).  Since -z
  413.      reads the lines from stdin, you can simply take the comment
  414.      from a file:
  415.  
  416.           zip -z foo < foowhat
  417.  
  418.      The -q (quiet) option eliminates the informational messages
  419.      and comment prompts while Zip is operating.  This might be
  420.      used in shell scripts, for example, or if the zip operation
  421.      is being performed as a background task ("zip -q foo *.c
  422.      &").
  423.  
  424.      Zip can take a list of file names to operate on from stdin
  425.      using the - option.  In Unix, this option can be used with
  426.      the find command to extend greatly the functionality of Zip.
  427.      For example, to zip up all the C source files in the current
  428.      directory and its subdirectories, you can:
  429.  
  430.           find . -type f -name "*.[ch]" -print | zip source -
  431.  
  432.      Note that the pattern must be quoted to keep the shell from
  433.      expanding it.
  434.  
  435.      Under VMS only, the -w option will append the version number
  436.      of the files to the name and zip up multiple versions of
  437.      files.  Without -w, Zip will only use the most recent ver-
  438.      sion of the specified file(s).
  439.  
  440.      If Zip is run with no arguments or with the -h option, the
  441.      license and the command-argument and option help is shown.
  442.      The -l option just shows the license.
  443.  
  444. ABOUT PATTERN MATCHING
  445.      (Note: this section applies to Unix.  Watch this space for
  446.      details on MSDOS and VMS operation.)
  447.  
  448.      The Unix shell (sh or csh) does filename substitution on
  449.      command arguments.  The special characters are ?, which
  450.      matches any single character; * which matches any number of
  451.      characters (including none); and [] which matches any char-
  452.      acter in the range inside the brackets (like [a-f] or
  453.      [0-9]).  When these characters are encountered (and not
  454.      escaped with a backslash or quotes), the shell will look for
  455.      files relative to the current path that match the pattern,
  456.      and replace the argument with a list of the names that
  457.      matched.
  458.  
  459.      Zip can do the same matching on names that are in the zip
  460.      file being modified or, in the case of the -x (exclude)
  461.      option, on the list of files to be operated on, by using
  462.      backslashes or quotes to tell the shell not to do the name
  463.      expansion.  In general, when Zip encounters a name in the
  464.      list of files to do, it first looks for the name in the file
  465.      system.  If it finds it, it then adds it to the list of
  466.      files to do.  If it does not find it, it will look for the
  467.      name in the zip file being modified (if it exists), using
  468.      the pattern matching characters above, if any.  For each
  469.      match, it will add that name to the list of files to do.
  470.      After -x (exclude), the names are removed from the to-do
  471.      list instead of added.
  472.  
  473.      The pattern matching includes the path, and so patterns like
  474.      \*.o match names that end in ".o", no matter what the path
  475.      prefix is.  Note that the backslash must precede every spe-
  476.      cial character (i.e. ?*[]), or the entire argument must be
  477.      enclosed in double quotes ("").
  478.  
  479.      In general, using backslash to make Zip do the pattern
  480.      matching is used with the -f (freshen) and -d (delete)
  481.      options, and sometimes after the -x (exclude) option when
  482.      used with any operation (add, -u, -f, or -d).  Zip will
  483.      never use pattern matching to search the file system.  If
  484.      Zip has recursed into a directory, all files (and all direc-
  485.      tories) in there are fair game.
  486.  
  487. COPYRIGHT
  488.      Copyright (C) 1990,1991 Mark Adler, Richard B. Wales, and
  489.      Jean-loup Gailly.  Permission is granted to any individual
  490.      or institution to use, copy, or redistribute this software
  491.      so long as all of the original files are included unmodi-
  492.      fied, that it is not sold for profit, and that this copy-
  493.      right notice is retained.
  494.  
  495. ACKNOWLEDGEMENTS
  496.      Thanks to R. P. Byrne for his Shrink.Pas program which
  497.      inspired this project, and from which the shrink algorithm
  498.      was stolen; to Phil Katz for making the zip file format,
  499.      compression format, and .ZIP filename extension all public
  500.      domain; to Keith Petersen for providing a mailing list and
  501.      ftp site for the INFO-ZIP group to use; and most impor-
  502.      tantly, to the INFO-ZIP group itself (listed in the file
  503.      infozip.who) without whose tireless testing and bug-fixing
  504.      efforts a portable Zip would not have been possible.
  505.      Finally we should thank (blame) the INFO-ZIP moderator,
  506.      David Kirschbaum for getting us into this mess in the first
  507.      place.
  508.  
  509. SEE ALSO
  510.      unzip(1), tar(1), compress(1)
  511.  
  512. BUGS
  513.      Versions of PKUNZIP before 1.1 have a bug that on rare occa-
  514.      sions will prevent it from unzipping files produced by Zip
  515.      or PKZIP 1.1.  If you experience such problems, we recommend
  516.      that you get PKUNZIP 1.1 or the portable Unzip, neither of
  517.      which have this problem.
  518.  
  519.      Under MSDOS, Zip will find hidden and system files, but not
  520.      set the attributes appropriately in the zip file so that
  521.      Unzip can restore them.  This will be fixed in the next
  522.      version.
  523.  
  524.      Under VMS, not all of the odd file formats are treated prop-
  525.      erly.  Only stream-LF format zip files are expected to work
  526.      with Zip.  Others can be converted using Rahul Dhesi's BILF
  527.      program.  The next version of Zip will handle some of the
  528.      conversion internally.
  529.  
  530.      LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTIL-
  531.      ITIES ARE PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY
  532.      KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE
  533.      COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES RESULTING FROM
  534.      THE USE OF THIS SOFTWARE.
  535.  
  536.      That having been said, please send any problems or comments
  537.      via email to the Internet address zip-bugs@cs.ucla.edu.  For
  538.      bug reports, please include the version of Zip, the make
  539.      options you used to compile it, the machine and operating
  540.      system you are using, and as much additional information as
  541.      possible.  Thank you for your support.
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.