home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / ARCHIVERS / zip_bin.lzh / zip.1 < prev    next >
Text File  |  1993-12-12  |  22KB  |  588 lines

  1. .\" Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
  2. .\" Kai Uwe Rommel and Igor Mandrichenko.
  3. .\" Permission is granted to any individual or institution to use, copy, or
  4. .\" redistribute this software so long as all of the original files are included
  5. .\" unmodified, that it is not sold for profit, and that this copyright notice
  6. .\" is retained.
  7. .\"
  8. .\" zip.1 by Mark Adler.
  9. .\"
  10. .TH ZIP 1
  11. .SH NAME
  12. zip, zipcloak, zipnote, zipsplit \- package and compress (archive) files
  13. .SH SYNOPSIS
  14. .B zip
  15. [
  16. .B \-cdeEfghjklmoqruwyz@
  17. ] [
  18. .B \-b
  19. temppath ] [
  20. .B \-n
  21. suffixes ] [
  22. .B \-t
  23. mmddyy ] [ zipfile list ] [
  24. .B \-x
  25. list ]
  26. .PP
  27. .B zipcloak
  28. [
  29. .B \-d
  30. ] [
  31. .BI -b " path"
  32. ]
  33. .I zipfile
  34. .PP
  35. .B zipnote
  36. [
  37. .B -w
  38. ] [
  39. .BI \-b " path"
  40. ]
  41. .I zipfile
  42. .PP
  43. .B zipsplit
  44. [
  45. .B \-ti
  46. ] [
  47. .BI \-n " size"
  48. ] [
  49. .BI \-b " path"
  50. ]
  51. .I zipfile
  52. .br
  53. .SH DESCRIPTION
  54. .I zip
  55. is a compression and file packaging utility for Unix, VMS, MSDOS,
  56. OS/2, Windows NT, Minix, Atari and Macintosh.  It is analogous to a
  57. combination of tar and compress and is compatible with PKZIP (Phil
  58. Katz ZIP) for MSDOS systems.
  59. .PP
  60. There is a companion to
  61. .I zip
  62. called
  63. .I unzip
  64. (of course) which you should be able
  65. to find the same place you got
  66. .I zip.  zip
  67. and
  68. .I unzip
  69. can work with files
  70. produced by PKZIP under MSDOS, and PKZIP and PKUNZIP can work with files
  71. produced by
  72. .I zip.
  73. .PP
  74. .I zip
  75. version 1.9 is compatible with pkzip 1.93a.
  76. Note that pkunzip 1.10 cannot extract files produced by pkzip 1.93a
  77. or zip 1.9. You must use pkunzip 1.93a or unzip 5.0 to extract them.
  78. .PP
  79. For a brief help on
  80. .I zip
  81. and
  82. .I unzip,
  83. run each without specifying any parameters on the command line.
  84. .PP
  85. .I zip
  86. puts one or more compressed files into a single "zip file" along with
  87. information about the files, including the name, path if requested, date
  88. and time last modified, protection, and check information to verify the
  89. fidelity of each entry.
  90. .I zip
  91. can also be used as a filter, compressing standard input to standard output.
  92. .I zip
  93. can pack an entire directory structure in a
  94. zip file with a single command.  Compression ratios of 2:1 to 3:1 are
  95. common for text files.
  96. .I zip
  97. has one compression method (deflation) and can also store files without
  98. compression. It automatically chooses the better of the two for each file
  99. to be compressed.
  100. .PP
  101. .I zip
  102. is useful for packaging a set of files to send to someone or for distribution;
  103. for archiving or backing up files; and for saving disk space by temporarily
  104. compressing unused files or directories.
  105. .SH "HOW TO USE ZIP"
  106. The simplest use of
  107. .I zip
  108. is as follows:
  109. .PP
  110. .ti +5n
  111. zip stuff *
  112. .PP
  113. This will create the file "stuff.zip" (assuming it does not exist) and put
  114. all the files in the current directory in stuff.zip in a compressed form.
  115. The .zip suffix is added automatically, unless that file name given contains
  116. a dot already.  This allows specifying suffixes other than ".zip".
  117. .PP
  118. Because of the way the shell does filename substitution, files that start
  119. with a "." are not included.  To include those as well, you can:
  120. .PP
  121. .ti +5n
  122. zip stuff .* *
  123. .PP
  124. Even this will not include any subdirectories that are in the current
  125. directory.  To zip up an entire directory, the command:
  126. .PP
  127. .ti +5n
  128. zip -r foo foo
  129. .PP
  130. will create the file "foo.zip" containing all the files and directories in
  131. the directory "foo" that is in the current directory. (The first "foo" denotes
  132. the zip file, the second one denotes the directory.)  The "r" option means
  133. recurse through the directory structure.  In this case, all the
  134. files and directories in foo are zipped, including the ones that start with
  135. a ".", since the recursion does not use the shell's file-name substitution.
  136. You should not use -r with the name ".*", since that matches ".." which will
  137. attempt to zip up the parent directory--probably not what was intended.
  138. .PP
  139. You may want to make a zip file that contains the files in foo, but not record
  140. the directory name, foo.  You can use the -j (junk path) option to leave off
  141. the path:
  142. .PP
  143. .ti +5n
  144. zip -j foo foo/*
  145. .PP
  146. The -y option (only under Unix) will store symbolic links as such in the
  147. zip file, instead of compressing and storing the file referred to in the link.
  148. .PP
  149. You might be zipping to save disk space, in which case you could:
  150. .PP
  151. .ti +5n
  152. zip -rm foo foo
  153. .PP
  154. where the "m" option means "move".  This will delete foo and its contents
  155. after making foo.zip.  No deletions will be done until the zip has completed
  156. with no errors.  This option is obviously more dangerous and should be
  157. used with care.
  158. .PP
  159. If the zip file already exists, these commands will replace existing or add
  160. new entries to the zip file.  For example, if you were really short on disk
  161. space, you might not have enough room simultaneously to hold the directory
  162. foo and the compressed foo.zip.  In this case, you could do it in steps.  If
  163. foo contained the subdirectories tom, dick, and harry, then you could:
  164. .PP
  165. .ti +5n
  166. zip -rm foo foo/tom
  167. .ti +5n
  168. zip -rm foo foo/dick
  169. .ti +5n
  170. zip -rm foo foo/harry
  171. .PP
  172. where the first command would create foo.zip, and the next two would add to
  173. it.  At the completion of each zip command, the directory just zipped would
  174. be deleted, making room in which the next
  175. .I zip
  176. command could work.
  177. .PP
  178. .I zip
  179. will also accept a single dash ("-") as the zip file name, in which case it
  180. will write the zip file to stdout, allowing the output to be piped to another
  181. program. For example:
  182. .PP
  183. .ti +5n
  184. zip -r - . | dd of=/dev/nrst0 obs=16k
  185. .PP
  186. would write the zip output directly to a tape with the specified block size
  187. for the purpose of backing up the current directory.
  188. .PP
  189. .I zip
  190. also accepts a single dash ("-") as the name of a file to be compressed, in
  191. which case it will read the zip file from stdin, allowing zip to take
  192. input from another program. For example:
  193. .PP
  194. .ti +5n
  195. tar cf - . | zip backup -
  196. .PP
  197. would compress the output of the tar command for the purpose of backing up
  198. the current directory. This generally produces better compression than
  199. the previous example using the -r option, because
  200. .I zip
  201. can take advantage of redundancy between files. The backup can be restored
  202. using the command
  203. .PP
  204. .ti +5n
  205. unzip -p backup | tar xf -
  206. .PP
  207. When no zip file name is given and stdout is not a terminal,
  208. .I zip
  209. acts as a filter, compressing standard input to standard output.
  210. For example,
  211. .PP
  212. .ti +5n
  213. tar cf - . | zip | dd of=/dev/nrst0
  214. .PP
  215. is equivalent to
  216. .PP
  217. .ti +5n
  218. tar cf - . | zip - - | dd of=/dev/nrst0
  219. .PP
  220. Zip archives created in this manner can be extracted with the program
  221. .I funzip
  222. which is provided in the
  223. .I unzip
  224. package. For example,
  225. .PP
  226. .ti +5n
  227.    dd if=/dev/nrst0 | funzip | tar xvf -
  228. .SH "MODIFYING EXISTING ZIP FILES"
  229. When given the name of an existing zip file with the above commands,
  230. .I zip
  231. will replace identically named entries in the
  232. .I zip
  233. file or add entries for
  234. new names.  For example, if foo.zip exists and contains foo/file1 and
  235. foo/file2, and the directory foo contains the files foo/file1 and foo/file3,
  236. then:
  237. .PP
  238. .ti +5n
  239. zip -r foo foo
  240. .PP
  241. will replace foo/file1 in foo.zip and add foo/file3 to foo.zip.  After
  242. this, foo.zip contains foo/file1, foo/file2, and foo/file3, with foo/file2
  243. unchanged from before.
  244. .PP
  245. When changing an existing zip file,
  246. .I zip
  247. will write a temporary file with
  248. the new contents, and only replace the old one when the zip has completed
  249. with no errors. You can use
  250. the -b option to specify a different path (usually a different device) to
  251. put the temporary file in.  For example:
  252. .PP
  253. .ti +5n
  254. zip -b /tmp stuff *
  255. .PP
  256. will put the temporary zip file and the temporary compression files in the
  257. directory "/tmp", copying over stuff.zip in the current directory when
  258. done.
  259. .PP
  260. If you are only adding entries to a zip file, not replacing, and the
  261. -g option is given, then
  262. .I zip
  263. grows (appends to) the file instead of copying it.  The danger of this is that
  264. if the operation fails, the original zip file is corrupted and lost.
  265. .PP
  266. There are two other ways to change or add entries in a zip file that are
  267. restrictions of simple addition or replacement.  The first is -u (update)
  268. which will add new entries to the zip file as before but will replace
  269. existing entries only if the modified date of the file is more recent than
  270. the date recorded for that name in the zip file.  For example:
  271. .PP
  272. .ti +5n
  273. zip -u stuff *
  274. .PP
  275. will add any new files in the current directory, and update any changed files
  276. in the zip file stuff.zip.  Note that
  277. .I zip
  278. will not try to pack stuff.zip into
  279. itself when you do this. 
  280. .I zip
  281. will always exclude the zip file from the files on which to be operated.
  282. .PP
  283. The second restriction is -f (freshen) which, like update, will only replace
  284. entries with newer files; unlike update, will not add files that are not
  285. already in the zip file.  For this option, you may want to simply freshen all
  286. of the files that are in the specified zip file.  To do this you would simply:
  287. .PP
  288. .ti +5n
  289. zip -f foo
  290. .PP
  291. Note that the -f option with no arguments freshens all the entries in the
  292. zip file.  The same is true of -u, and hence "zip -u foo" and "zip -f foo"
  293. both do the same thing.
  294. .PP
  295. This command should
  296. be run from the same directory from which the original zip command was run,
  297. since paths stored in zip files are always relative.
  298. .PP
  299. Another restriction that can be used with adding, updating, or freshening is
  300. -t (time), which will not operate on files modified earlier than the specified
  301. date.  For example:
  302. .PP
  303. .ti +5n
  304. zip -rt 120791 infamy foo
  305. .PP
  306. will add all the files in foo and its subdirectories that were last modified
  307. on December 7, 1991, or later to the zip file infamy.zip.
  308. .PP
  309. Also, files can be explicitly excluded using the -x option:
  310. .PP
  311. .ti +5n
  312. zip -r foo foo -x \\*.o
  313. .PP
  314. which will zip up the contents of foo into foo.zip but exclude all the
  315. files that end in ".o".  Here the backslash causes
  316. .I zip
  317. to match file names
  318. that were found when foo was searched.
  319. .PP
  320. The last operation is -d (delete) which will remove entries from a zip file.
  321. An example might be:
  322. .PP
  323. .ti +5n
  324. zip -d foo foo/tom/junk foo/harry/\\* \\*.o
  325. .PP
  326. which will remove the entry foo/tom/junk, all of the files that start with
  327. "foo/harry/", and all of the files that end with ".o" (in any path).  Note
  328. that once again, the shell expansion has been inhibited with backslashes, so
  329. that
  330. .I zip
  331. can see the asterisks.  
  332. .I zip
  333. can then match on the contents of the zip
  334. file instead of the contents of the current directory.
  335. .PP
  336. Under MSDOS, -d is case sensitive when it matches names in the zip file.
  337. This allows deleting names that were zipped on other systems, but requires
  338. that the names be entered in upper case if they were zipped on an MSDOS
  339. system, so that the names can be found in the zip file and deleted.
  340. .SH "MORE OPTIONS"
  341. As mentioned before,
  342. .I zip
  343. will use the best of two methods: deflate or store.
  344. .PP
  345. The option -0 will force
  346. .I zip
  347. to use store on all files. For example:
  348. .PP
  349. .ti +5n
  350. zip -r0 foo foo
  351. .PP
  352. will zip up the directory foo into foo.zip using only store.
  353. .PP
  354. The speed of deflation can also be controlled with options -1 (fastest
  355. method but less compression) to -9 (best compression but slower). The
  356. default value is -5. For example:
  357. .PP
  358. .ti +5n
  359. zip -r8 foo foo
  360. .PP
  361. In nearly all cases, a file that is already compressed cannot be compressed
  362. further by
  363. .I zip,
  364. or if it can, the effect is minimal.  The -n option prevents
  365. .I zip
  366. from trying to compress files that have the given suffixes.
  367. Such files are simply stored (0% compression) in the output zip file,
  368. so that
  369. .I zip
  370. doesn't waste its time trying to compress them.
  371. The suffixes are separated by
  372. either colons or semicolons.  For example:
  373. .PP
  374. .ti +5n
  375. zip -rn ".Z:.zip:.tiff:.gif:.snd"  foo foo
  376. .PP
  377. will put everything in foo into foo.zip, but will store any files that end
  378. in .Z, .zip, .tiff, .gif, or .snd without trying to compress them.  (Image
  379. and sound files often have their own specialized compression methods.)
  380. The default suffix list is ".Z:.zip;.zoo:.arc:.lzh:.arj".
  381. The environment variable ZIPOPT can be used to change this default. For
  382. example under Unix with csh:
  383. .PP
  384. .ti +5n
  385. setenv ZIPOPT "-n .gif:.zip"
  386. .PP
  387. The variable ZIPOPT can be used for any option and can include several
  388. options.
  389. .PP
  390. Under Unix and under OS/2 (if files from an HPFS are stored),
  391. .I zip
  392. will store the full path (relative to the current path) and name of the
  393. file (or just the name if -j is specified) in the zip file along with the
  394. Unix attributes, and it will mark
  395. the entry as made under Unix.  If the zip file is intended for PKUNZIP under
  396. MSDOS, then the -k (Katz) option should be used to attempt to convert the
  397. names and paths to conform to MSDOS, store only the MSDOS attribute (just
  398. the user write attribute from Unix), and mark the entry as made under MSDOS
  399. (even though it wasn't).
  400. .PP
  401. The -o (older) option will set the "last modified" time of the zip file to
  402. the latest "last modified" time of the entries in the zip file.  This can
  403. be used without any other operations, if desired.  For example:
  404. .PP
  405. .ti +5n
  406. zip -o foo
  407. .PP
  408. will change the last modified time of foo.zip to the latest time of the
  409. entries in foo.zip.
  410. .PP
  411. The -e and -c options operate on all files updated or added to the zip file.
  412. Encryption (-e) will prompt for a password on the terminal and will
  413. not echo the password as it is typed (if stderr is not a TTY, zip will exit
  414. with an error).  New zip entries will be encrypted using that password.  For
  415. added peace of mind, you can use -ee, which will prompt for the password
  416. twice, checking that the two are the same before using it. The encryption
  417. code is distributed separately, so the -e option may not be available
  418. in your version.
  419. .PP
  420. One-line comments can be added for each file with the -c option.  The zip
  421. file operations (adding or updating) will be done first, and you will then be
  422. prompted for a one-line comment for each file.  You can then enter the comment
  423. followed by return, or just return for no comment.
  424. .PP
  425. The -z option will prompt you for a multi-line comment for the entire zip
  426. file.  This option can be used by itself, or in combination with other
  427. options.  The comment is ended by a line containing just a period, or an end
  428. of file condition (^D on Unix, ^Z on MSDOS, OS/2, and VAX/VMS).
  429. Since -z reads the
  430. lines from stdin, you can simply take the comment from a file:
  431. .PP
  432. .ti +5n
  433. zip -z foo < foowhat
  434. .PP
  435. The -q (quiet) option eliminates the informational messages and comment prompts
  436. while
  437. .I zip
  438. is operating.  This might be used in shell scripts, for example, or if the
  439. zip operation is being performed as a background task ("zip -q foo *.c &").
  440. .PP
  441. .I zip
  442. can take a list of file names to operate on from stdin using the -@ option.
  443. In Unix, this option can be used with the find command to extend greatly
  444. the functionality of
  445. .I zip.
  446. For example, to zip up all the C source files in the current directory and
  447. its subdirectories, you can:
  448. .PP
  449. .ti +5n
  450. find . -type f -name "*.[ch]" -print | zip source -@
  451. .PP
  452. Note that the pattern must be quoted to keep the shell from expanding it.
  453. .PP
  454. Under VMS only, the -w option will append the version number of the files to
  455. the name and zip up multiple versions of files.  Without -w,
  456. .I zip
  457. will only use the most recent version of the specified file(s).
  458. .PP
  459. The -l option translates the Unix end-of-line character LF into the
  460. MSDOS convention CR LF. This option should not be used on binary files.
  461. This option can be used on Unix if the zip file is intended for PKUNZIP
  462. under MSDOS. If the input files already contain CR LF, this option adds
  463. an extra CR. This ensure that "unzip -a" on Unix will get back an exact
  464. copy of the original file, to undo the effect of "zip -l".
  465. .PP
  466. If
  467. .I zip
  468. is run with the -h option, or with no arguments and standard output is
  469. a terminal, the license and the command-argument and option help is shown.
  470. The -L option just shows the license.
  471. .SH "ABOUT PATTERN MATCHING"
  472. (Note: this section applies to Unix.  Watch this space for details on MSDOS
  473. and VMS operation.)
  474. .PP
  475. The Unix shell (sh or csh) does filename substitution on command arguments.
  476. The special characters are ?, which matches any single character; * which
  477. matches any number of characters (including none); and [] which matches any
  478. character in the range inside the brackets (like [a\-f] or [0\-9]).  When
  479. these characters are encountered (and not escaped with a backslash or
  480. quotes), the
  481. shell will look for files relative to the current path that match the
  482. pattern, and replace the argument with a list of the names that matched.
  483. .PP
  484. .I zip
  485. can do the same matching on names that are in the zip file being
  486. modified or, in the case of the -x (exclude) option, on the list of
  487. files to be operated on, by using backslashes or quotes
  488. to tell the shell not to do the name expansion.  In general, when
  489. .I zip
  490. encounters a name in the list
  491. of files to do, it first looks for the name in the file system.  If it
  492. finds it, it then adds it to the list of files to do.  If it does not
  493. find it, it will look for the name in the zip file being modified (if it
  494. exists), using the pattern matching characters above, if any.  For each
  495. match, it will add that name to the list of files to do.  After -x
  496. (exclude), the names are removed from the to-do list instead of added.
  497. .PP
  498. The pattern matching includes the path, and so patterns like \\*.o match
  499. names that end in ".o", no matter what the path prefix is.  Note that the
  500. backslash must precede every special character (i.e. ?*[]), or the entire
  501. argument must be enclosed in double quotes ("").
  502. .PP
  503. In general, using backslash to make
  504. .I zip
  505. do the pattern matching is used
  506. with the -f (freshen) and -d (delete) options, and sometimes after the
  507. -x (exclude) option when used with any operation (add, -u, -f, or -d).
  508. .I zip
  509. will never use pattern matching to search the file system.  If
  510. .I zip
  511. has recursed into a directory, all files (and all directories) in there
  512. are fair game.
  513. .SH COPYRIGHT
  514. Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
  515. Kai Uwe Rommel and Igor Mandrichenko.
  516. Permission is granted to any individual or institution to use, copy, or
  517. redistribute this software so long as all of the original files are included
  518. unmodified, that it is not sold for profit, and that this copyright notice
  519. is retained.
  520. .SH ACKNOWLEDGEMENTS
  521. Thanks to R. P. Byrne for his Shrink.Pas program which inspired this project;
  522. to Phil Katz for making the zip
  523. file format, compression format, and .zip filename extension all public domain;
  524. to Steve Burg and Phil Katz for help on unclear points of the deflate format;
  525. to Keith Petersen and Rich Wales for providing a mailing list and ftp site for
  526. the INFO-ZIP group to use; and most importantly, to the INFO-ZIP group itself
  527. (listed in the file infozip.who) without whose tireless testing and bug-fixing
  528. efforts a portable
  529. .I zip
  530. would not have been possible.  Finally we should thank (blame) the INFO-ZIP
  531. moderator, David Kirschbaum for getting us into this mess in the first place.
  532. .SH "SEE ALSO"
  533. unzip(1), tar(1), compress(1)
  534. .SH BUGS
  535. WARNING: zip files produced by zip 1.9 must not be
  536. *updated* by zip 1.0 or pkzip 1.10 or pkzip 1.93a, if they contain
  537. encrypted members, or if they have been produced in a pipe or on a non
  538. seekable device. The old versions of zip or pkzip would destroy the
  539. zip structure. The old versions can list the contents of the zip file
  540. but cannot extract it anyway (because of the new compression algorithm).
  541. If you do not use encryption and use regular disk files, you do
  542. not have to care about this problem.
  543. .PP
  544. zip 1.9 is compatible with pkzip 1.93a, except when two features
  545. are used: encryption or zip file created in a pipe or on a non
  546. seekable device. pkzip versions above 2.0 will support such files, and
  547. unzip 5.0 already supports them.
  548. .PP
  549. Without -y, when zip must compress a symbolic link to an non existing file,
  550. it only displays a warning "name not matched". A better warnign should be
  551. given.
  552. .PP
  553. Under VMS, not all of the odd file formats are treated properly.  Only
  554. zip files of format stream-LF and fixed length 512 are expected to work
  555. with zip.  Others can be converted using Rahul Dhesi's BILF program.
  556. This version of zip does handle some of the conversion internally.
  557. When using Kermit to transfer zip files from Vax to MSDOS, type "set
  558. file type block" on the Vax.  When transfering from MSDOS to Vax, type
  559. "set file type fixed" on the Vax.  In both cases, type "set file type
  560. binary" on MSDOS.
  561. .PP
  562. Under VMS, zip hangs for file specification that uses DECnet syntax (foo::*.*).
  563. .PP
  564. Under OS/2, the amount of External Attributes displayed by DIR is (for
  565. compatibility) the amount returned by the 16-bit version of
  566. DosQueryPathInfo(). Otherwise OS/2 1.3 and 2.0 would report different
  567. EA sizes when DIRing a file.
  568. However, the structure layout returned by the 32-bit DosQueryPathInfo()
  569. is a bit different, it uses extra padding bytes and link pointers (it's
  570. a linked list) to have all fields on 4-byte boundaries for portability
  571. to future RISC OS/2 versions. Therefore the value reported by ZIP
  572. (which uses this 32-bit-mode size) differs from that reported by DIR.
  573. ZIP stores the 32-bit format for portability, even the 16-bit
  574. MS-C-compiled version running on OS/2 1.3, so even this one shows the
  575. 32-bit-mode size.
  576. .PP
  577. LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTILITIES ARE
  578. PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR
  579. IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES
  580. RESULTING FROM THE USE OF THIS SOFTWARE.
  581. .PP
  582. That having been said, please send any problems or comments via email to
  583. the Internet address
  584. zip\-bugs@cs.ucla.edu.  For bug reports, please include the
  585. version of zip, the make options you used to compile it, the machine and
  586. operating system you are using, and as much additional information as
  587. possible.  Thank you for your support.
  588.