Penguin
Annotated edit history of zipinfo(1) version 2, including all changes. View license author blame.
Rev Author # Line
1 perry 1 ZIPINFO
2 !!!ZIPINFO
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 ARGUMENTS
7 OPTIONS
8 DETAILED DESCRIPTION
9 ENVIRONMENT OPTIONS
10 EXAMPLES
11 TIPS
12 BUGS
13 SEE ALSO
14 URL
15 AUTHOR
16 ----
17 !!NAME
18
19
20 zipinfo - list detailed information about a ZIP archive
21 !!SYNOPSIS
22
23
24 __zipinfo__ [[__-12smlvhMtTz__]
25 ''file''[[''.zip''] [[''file(s)'' ...] [[__-x__
26 ''xfile(s)'' ...]
27
28
29 __unzip -Z__ [[__-12smlvhMtTz__]
30 ''file''[[''.zip''] [[''file(s)'' ...] [[__-x__
31 ''xfile(s)'' ...]
32 !!DESCRIPTION
33
34
35 ''zipinfo'' lists technical information about files in a
36 ZIP archive, most commonly found on MS-DOS systems. Such
37 information includes file access permissions, encryption
38 status, type of compression, version and operating system or
39 file system of compressing program, and the like. The
40 default behavior (with no options) is to list single-line
41 entries for each file in the archive, with header and
42 trailer lines providing summary information for the entire
43 archive. The format is a cross between Unix ``ls
44 -l'' and ``unzip -v'' output. See __DETAILED
45 DESCRIPTION__ below. Note that ''zipinfo'' is the same
46 program as ''unzip'' (under Unix, a link to it); on some
47 systems, however, ''zipinfo'' support may have been
48 omitted when ''unzip'' was compiled.
49 !!ARGUMENTS
50
51
52 ''file''[[''.zip'']
53
54
55 Path of the ZIP archive(s). If the file specification is a
56 wildcard, each matching file is processed in an order
57 determined by the operating system (or file system). Only
58 the filename can be a wildcard; the path itself cannot.
59 Wildcard expressions are similar to Unix egrep(1)
60 (regular) expressions and may contain:
61
62
63 *
64
65
66 matches a sequence of 0 or more characters
67
68
69 ?
70
71
72 matches exactly 1 character
73
74
75 [[...]
76
77
78 matches any single character found inside the brackets;
79 ranges are specified by a beginning character, a hyphen, and
80 an ending character. If an exclamation point or a caret (`!'
81 or `^') follows the left bracket, then the range of
82 characters within the brackets is complemented (that is,
83 anything ''except'' the characters inside the brackets is
84 considered a match).
85
86
87 (Be sure to quote any character that might otherwise be
88 interpreted or modified by the operating system,
89 particularly under Unix and VMS.) If no matches are found,
90 the specification is assumed to be a literal filename; and
91 if that also fails, the suffix .zip is appended.
92 Note that self-extracting ZIP files are supported; just
93 specify the .exe suffix (if any)
94 explicitly.
95
96
97 [[''file(s)'']
98
99
100 An optional list of archive members to be processed. Regular
101 expressions (wildcards) may be used to match multiple
102 members; see above. Again, be sure to quote expressions that
103 would otherwise be expanded or modified by the operating
104 system.
105
106
107 [[__-x__ ''xfile(s)'']
108
109
110 An optional list of archive members to be excluded from
111 processing.
112 !!OPTIONS
113
114
115 __-1__
116
117
118 list filenames only, one per line. This option excludes all
119 others; headers, trailers and zipfile comments are never
120 printed. It is intended for use in Unix shell
121 scripts.
122
123
124 __-2__
125
126
127 list filenames only, one per line, but allow headers
128 (__-h__), trailers (__-t__) and zipfile comments
129 (__-z__), as well. This option may be useful in cases
130 where the stored filenames are particularly
131 long.
132
133
134 __-s__
135
136
137 list zipfile info in short Unix ``ls -l'' format.
138 This is the default behavior; see below.
139
140
141 __-m__
142
143
144 list zipfile info in medium Unix ``ls -l'' format.
145 Identical to the __-s__ output, except that the
146 compression factor, expressed as a percentage, is also
147 listed.
148
149
150 __-l__
151
152
153 list zipfile info in long Unix ``ls -l'' format. As
154 with __-m__ except that the compressed size (in bytes) is
155 printed instead of the compression ratio.
156
157
158 __-v__
159
160
161 list zipfile information in verbose, multi-page
162 format.
163
164
165 __-h__
166
167
168 list header line. The archive name, actual size (in bytes)
169 and total number of files is printed.
170
171
172 __-M__
173
174
175 pipe all output through an internal pager similar to the
176 Unix more(1) command. At the end of a screenful of
177 output, ''zipinfo'' pauses with a ``--More--'' prompt;
178 the next screenful may be viewed by pressing the Enter
179 (Return) key or the space bar. ''zipinfo'' can be
180 terminated by pressing the ``q'' key and, on some systems,
181 the Enter/Return key. Unlike Unix more(1), there is
182 no forward-searching or editing capability. Also,
183 ''zipinfo'' doesn't notice if long lines wrap at the edge
184 of the screen, effectively resulting in the printing of two
185 or more lines and the likelihood that some text will scroll
186 off the top of the screen before being viewed. On some
187 systems the number of available lines on the screen is not
188 detected, in which case ''zipinfo'' assumes the height is
189 24 lines.
190
191
192 __-t__
193
194
195 list totals for files listed or for all files. The number of
196 files listed, their uncompressed and compressed total sizes,
197 and their overall compression factor is printed; or, if only
198 the totals line is being printed, the values for the entire
199 archive are given. Note that the total compressed (data)
200 size will never match the actual zipfile size, since the
201 latter includes all of the internal zipfile headers in
202 addition to the compressed data.
203
204
205 __-T__
206
207
208 print the file dates and times in a sortable decimal format
209 (yymmdd.hhmmss). The default date format is a more standard,
210 human-readable version with abbreviated month names (see
211 examples below).
212
213
214 __-z__
215
216
217 include the archive comment (if any) in the
218 listing.
219 !!DETAILED DESCRIPTION
220
221
222 ''zipinfo'' has a number of modes, and its behavior can
223 be rather difficult to fathom if one isn't familiar with
224 Unix ls(1) (or even if one is). The default behavior
225 is to list files in the following format:
226
227
228 -rw-rws--- 1.9 unx 2802 t- defX 11-Aug-91 13:48 perms.2660The last three fields are the modification date and time of the file, and its name. The case of the filename is respected; thus files that come from MS-DOS PKZIP are always capitalized. If the file was zipped with a stored directory name, that is also displayed as part of the filename.
229
230
231 The second and third fields indicate that the file was
232 zipped under Unix with version 1.9 of ''zip''. Since it
233 comes from Unix, the file permissions at the beginning of
234 the line are printed in Unix format. The uncompressed
235 file-size (2802 in this example) is the fourth
236 field.
237
238
239 The fifth field consists of two characters, either of which
240 may take on several values. The first character may be
241 either `t' or `b', indicating that ''zip'' believes the
242 file to be text or binary, respectively; but if the file is
243 encrypted, ''zipinfo'' notes this fact by capitalizing
244 the character (`T' or `B'). The second character may also
245 take on four values, depending on whether there is an
246 extended local header and/or an ``extra field'' associated
247 with the file (fully explained in PKWare's APPNOTE.TXT, but
248 basically analogous to pragmas in ANSI C--i.e., they provide
249 a standard way to include non-standard information in the
250 archive). If neither exists, the character will be a hyphen
251 (`-'); if there is an extended local header but no extra
252 field, `l'; if the reverse, `x'; and if both exist, `X'.
253 Thus the file in this example is (probably) a text file, is
254 not encrypted, and has neither an extra field nor an
255 extended local header associated with it. The example below,
256 on the other hand, is an encrypted binary file with an extra
257 field:
258
259
260 RWD,R,R 0.9 vms 168 Bx shrk 9-Aug-91 19:15 perms.0644Extra fields are used for various purposes (see discussion of the __-v__ option below) including the storage of VMS file attributes, which is presumably the case here. Note that the file attributes are listed in VMS format. Some other possibilities for the host operating system (which is actually a misnomer--host file system is more correct) include OS/2 or NT with High Performance File System (HPFS), MS-DOS, OS/2 or NT with File Allocation Table (FAT) file system, and Macintosh. These are denoted as follows:
261
262
263 -rw-a-- 1.0 hpf 5358 Tl i4:3 4-Dec-91 11:33 longfilename.hpfs
264 -r--ahs 1.1 fat 4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF
265 --w------- 1.0 mac 17357 bx i8:2 4-May-92 04:02 unzip.macrFile attributes in the first two cases are indicated in a Unix-like format, where the seven subfields indicate whether the file: (1) is a directory, (2) is readable (always true), (3) is writable, (4) is executable (guessed on the basis of the extension--''.exe'', ''.com'', ''.bat'', ''.cmd'' and ''.btm'' files are assumed to be so), (5) has its archive bit set, (6) is hidden, and (7) is a system file. Interpretation of Macintosh file attributes is unreliable because some Macintosh archivers don't store any attributes in the archive.
266
267
268 Finally, the sixth field indicates the compression method
269 and possible sub-method used. There are six methods known at
270 present: storing (no compression), reducing, shrinking,
271 imploding, tokenizing (never publicly released), and
272 deflating. In addition, there are four levels of reducing (1
273 through 4); four types of imploding (4K or 8K sliding
274 dictionary, and 2 or 3 Shannon-Fano trees); and four levels
275 of deflating (superfast, fast, normal, maximum compression).
276 ''zipinfo'' represents these methods and their
277 sub-methods as follows: ''stor''; ''re:1'',
278 ''re:2'', etc.; ''shrk''; ''i4:2'', ''i8:3'',
279 etc.; ''tokn''; and ''defS'', ''defF'',
280 ''defN'', and ''defX''.
281
282
283 The medium and long listings are almost identical to the
284 short format except that they add information on the file's
285 compression. The medium format lists the file's compression
286 factor as a percentage indicating the amount of space that
287 has been ``removed'':
288
289
290 -rw-rws--- 1.5 unx 2802 t- 81% defX 11-Aug-91 13:48 perms.2660In this example, the file has been compressed by more than a factor of five; the compressed data are only 19% of the original size. The long format gives the compressed file's size in bytes, instead:
291
292
293 -rw-rws--- 1.5 unx 2802 t- 538 defX 11-Aug-91 13:48 perms.2660Adding the __-T__ option changes the file date and time to decimal format:
294
295
296 -rw-rws--- 1.5 unx 2802 t- 538 defX 910811.134804 perms.2660Note that because of limitations in the MS-DOS format used to store file times, the seconds field is always rounded to the nearest even second. For Unix files this is expected to change in the next major releases of ''zip''(1L) and ''unzip''.
297
298
299 In addition to individual file information, a default
300 zipfile listing also includes header and trailer
301 lines:
302
303
304 Archive: OS2.zip 5453 bytes 5 files
305 ,,rw, 1.0 hpf 730 b- i4:3 26-Jun-92 23:40 Contents
306 ,,rw, 1.0 hpf 3710 b- i4:3 26-Jun-92 23:33 makefile.os2
307 ,,rw, 1.0 hpf 8753 b- i8:3 26-Jun-92 15:29 os2unzip.c
308 ,,rw, 1.0 hpf 98 b- stor 21-Aug-91 15:34 unzip.def
309 ,,rw, 1.0 hpf 95 b- stor 21-Aug-91 17:51 zipinfo.def
310 5 files, 13386 bytes uncompressed, 4951 bytes compressed: 63.0%The header line gives the name of the archive, its total size, and the total number of files; the trailer gives the number of files listed, their total uncompressed size, and their total compressed size (not including any of ''zip'''s internal overhead). If, however, one or more ''file(s)'' are provided, the header and trailer lines are not listed. This behavior is also similar to that of Unix's ``ls -l''; it may be overridden by specifying the __-h__ and __-t__ options explicitly. In such a case the listing format must also be specified explicitly, since __-h__ or __-t__ (or both) in the absence of other options implies that ONLY the header or trailer line (or both) is listed. See the __EXAMPLES__ section below for a semi-intelligible translation of this nonsense.
311
312
313 The verbose listing is mostly self-explanatory. It also
314 lists file comments and the zipfile comment, if any, and the
315 type and number of bytes in any stored extra fields.
316 Currently known types of extra fields include PKWARE's
317 authentication (``AV'') info; OS/2 extended attributes; VMS
318 filesystem info, both PKWARE and Info-ZIP versions;
319 Macintosh resource forks; Acorn/Archimedes SparkFS info; and
320 so on. (Note that in the case of OS/2 extended
321 attributes--perhaps the most common use of zipfile extra
322 fields--the size of the stored EAs as reported by
323 ''zipinfo'' may not match the number given by OS/2's
324 ''dir'' command: OS/2 always reports the number of bytes
325 required in 16-bit format, whereas ''zipinfo'' always
326 reports the 32-bit storage.)
327 !!ENVIRONMENT OPTIONS
328
329
330 Modifying ''zipinfo'''s default behavior via options
331 placed in an environment variable can be a bit complicated
332 to explain, due to ''zipinfo'''s attempts to handle
333 various defaults in an intuitive, yet Unix-like, manner.
334 (Try not to laugh.) Nevertheless, there is some underlying
335 logic. In brief, there are three ``priority levels'' of
336 options: the default options; environment options, which can
337 override or add to the defaults; and explicit options given
338 by the user, which can override or add to either of the
339 above.
340
341
342 The default listing format, as noted above, corresponds
343 roughly to the zipinfo -hst
344 -l__) can
345 make use of the ''zipinfo'''s environment variable to
346 change this default:
347
348
349 Unix Bourne shell:
350
351
352 ZIPINFO=-l; export ZIPINFO
353
354
355 Unix C shell:
356
357
358 setenv ZIPINFO -l
359
360
361 OS/2 or MS-DOS:
362
363
364 set ZIPINFO=-l
365
366
367 VMS (quotes for ''lowercase''):
368
369
370 define ZIPINFO_OPTS
371
372
373 If, in addition, the user dislikes the trailer line,
374 ''zipinfo'''s concept of ``negative options'' may be used
375 to override the default inclusion of the line. This is
376 accomplished by preceding the undesired option with one or
377 more minuses: e.g., ``-l-t'' or ``--tl'',
378 in this example. The first hyphen is the regular switch
379 character, but the one before the `t' is a minus sign. The
380 dual use of hyphens may seem a little awkward, but it's
381 reasonably intuitive nonetheless: simply ignore the first
382 hyphen and go from there. It is also consistent with the
383 behavior of the Unix command nice(1).
384
385
386 As suggested above, the default variable names are
387 ZIPINFO_OPTS for VMS (where the symbol used to install
388 ''zipinfo'' as a foreign command would otherwise be
389 confused with the environment variable), and ZIPINFO for all
390 other operating systems. For compatibility with
391 ''zip''(1L), ZIPINFOOPT is also accepted (don't ask). If
392 both ZIPINFO and ZIPINFOOPT are defined, however, ZIPINFO
393 takes precedence. ''unzip'''s diagnostic option
394 (__-v__ with no zipfile name) can be used to check the
395 values of all four possible ''unzip'' and ''zipinfo''
396 environment variables.
397 !!EXAMPLES
398
399
400 To get a basic, short-format listing of the complete
401 contents of a ZIP archive ''storage.zip'', with both
402 header and totals lines, use only the archive name as an
403 argument to zipinfo:
404
405
406 zipinfo storage
407
408
409 To produce a basic, long-format listing (not verbose),
410 including header and totals lines, use
411 __-l__:
412
413
414 zipinfo -l storage
415
416
417 To list the complete contents of the archive without header
418 and totals lines, either negate the __-h__ and __-t__
419 options or else specify the contents
420 explicitly:
421
422
423 zipinfo --h-t storage
424 zipinfo storage *
425
426
427 (where the backslash is required only if the shell would
428 otherwise expand the `*' wildcard, as in Unix when globbing
429 is turned on--double quotes around the asterisk would have
430 worked as well). To turn off the totals line by default, use
431 the environment variable (C shell is assumed
432 here):
433
434
435 setenv ZIPINFO --t
436 zipinfo storage
437
438
439 To get the full, short-format listing of the first example
440 again, given that the environment variable is set as in the
441 previous example, it is necessary to specify the __-s__
442 option explicitly, since the __-t__ option by itself
443 implies that ONLY the footer line is to be
444 printed:
445
446
447 setenv ZIPINFO --t
448 zipinfo -t storage [[only totals line]
449 zipinfo -st storage [[full listing]
450
451
452 The __-s__ option, like __-m__ and __-l__, includes
453 headers and footers by default, unless otherwise specified.
454 Since the environment variable specified no footers and that
455 has a higher precedence than the default behavior of
456 __-s__, an explicit __-t__ option was necessary to
457 produce the full listing. Nothing was indicated about the
458 header, however, so the __-s__ option was sufficient.
459 Note that both the __-h__ and __-t__ options, when
460 used by themselves or with each other, override any default
461 listing of member files; only the header and/or footer are
462 printed. This behavior is useful when ''zipinfo'' is used
463 with a wildcard zipfile specification; the contents of all
464 zipfiles are then summarized with a single
465 command.
466
467
468 To list information on a single file within the archive, in
469 medium format, specify the filename explicitly:
470
471
472 zipinfo -m storage unshrink.c
473
474
475 The specification of any member file, as in this example,
476 will override the default header and totals lines; only the
477 single line of information about the requested file will be
478 printed. This is intuitively what one would expect when
479 requesting information about a single file. For multiple
480 files, it is often useful to know the total compressed and
481 uncompressed size; in such cases __-t__ may be specified
482 explicitly:
483
484
485 zipinfo -mt storage
486
487
488 To get maximal information about the ZIP archive, use the
489 verbose option. It is usually wise to pipe the output into a
490 filter such as Unix more(1) if the operating system
491 allows it:
492
493
494 zipinfo -v storage | more
495
496
497 Finally, to see the most recently modified files in the
498 archive, use the __-T__ option in conjunction with an
499 external sorting utility such as Unix sort(1) (and
500 tail(1) as well, in this example):
501
502
503 zipinfo -T storage | sort -n +6 | tail -15
504
505
506 The __-n__ option to sort(1) tells it to sort
507 numerically rather than in ASCII order, and the __+6__
508 option tells it to sort on the sixth field after the first
509 one (i.e., the seventh field). This assumes the default
510 short-listing format; if __-m__ or __-l__ is used, the
511 proper sort(1) option would be __+7__. The
512 tail(1) command filters out all but the last 15 lines
513 of the listing. Future releases of ''zipinfo'' may
514 incorporate date/time and filename sorting as built-in
515 options.
516 !!TIPS
517
518
519 The author finds it convenient to define an alias ''ii''
520 for ''zipinfo'' on systems that allow aliases (or, on
521 other systems, copy/rename the executable, create a link or
522 create a command file with the name ''ii''). The
523 ''ii'' usage parallels the common ''ll'' alias for
524 long listings in Unix, and the similarity between the
525 outputs of the two commands was intentional.
526 !!BUGS
527
528
529 As with ''unzip'', ''zipinfo'''s __-M__ (``more'')
530 option is overly simplistic in its handling of screen
531 output; as noted above, it fails to detect the wrapping of
532 long lines and may thereby cause lines at the top of the
533 screen to be scrolled off before being read. ''zipinfo''
534 should detect and treat each occurrence of line-wrap as one
535 additional line printed. This requires knowledge of the
536 screen's width as well as its height. In addition,
537 ''zipinfo'' should detect the true screen geometry on all
538 systems.
539
540
541 ''zipinfo'''s listing-format behavior is unnecessarily
542 complex and should be simplified. (This is not to say that
543 it will be.)
544 !!SEE ALSO
545
546
547 ls(1), ''funzip''(1L), ''unzip''(1L),
548 ''unzipsfx''(1L), ''zip''(1L), ''zipcloak''(1L),
549 ''zipnote''(1L), ''zipsplit''(1L)
550 !!URL
551
552
553 The Info-ZIP home page is currently at
554
555
556 http://www.info-zip.org/pub/infozip/
557
558
559 or
560
561
562 ftp://ftp.info-zip.org/pub/infozip/ .
563 !!AUTHOR
564
565
2 perry 566 Greg ``Cave Newt'' Roelofs. !ZipInfo contains
1 perry 567 pattern-matching code by Mark Adler and fixes/improvements
568 by many others. Please refer to the CONTRIBS file in the
2 perry 569 !UnZip source distribution for a more complete
1 perry 570 list.
571 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.