File: ziptool.man

package info (click to toggle)
libzip 1.11.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,632 kB
  • sloc: ansic: 17,309; sh: 85; perl: 55; makefile: 5
file content (435 lines) | stat: -rw-r--r-- 8,975 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
.\" Automatically generated from an mdoc input file.  Do not edit.
.\" ziptool.mdoc -- modify zip archives in multiple ways
.\" Copyright (C) 2016-2022 Dieter Baron and Thomas Klausner
.\"
.\" This file is part of libzip, a library to manipulate ZIP archives.
.\" The authors can be contacted at <info@libzip.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in
.\"    the documentation and/or other materials provided with the
.\"    distribution.
.\" 3. The names of the authors may not be used to endorse or promote
.\"    products derived from this software without specific prior
.\"    written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.TH "ZIPTOOL" "1" "January 23, 2023" "NiH" "General Commands Manual"
.nh
.if n .ad l
.SH "NAME"
\fBziptool\fR
\- modify zip archives
.SH "SYNOPSIS"
.HP 8n
\fBziptool\fR
[\fB\-ceghnrst\fR]
[\fB\-l\fR\ \fIlength\fR]
[\fB\-o\fR\ \fIoffset\fR]
\fIzip-archive\fR
\fBcommand\fR\ [\fIcommand-args\ ...\fR]
[\fBcommand\fR\ [\fIcommand-args\ ...\fR]\ ...]
.SH "DESCRIPTION"
\fBziptool\fR
modifies the zip archive
\fIzip-archive\fR
according to the
\fIcommands\fR
given.
.PP
Supported options:
.TP 13n
\fB\-c\fR
Check zip archive consistency when opening it.
.TP 13n
\fB\-e\fR
Error if archive already exists (only useful with
\fB\-n\fR).
.TP 13n
\fB\-g\fR
Guess file name encoding (for
\fBstat\fR
command).
.TP 13n
\fB\-h\fR
Display help.
.TP 13n
\fB\-l\fR \fIlength\fR
Only read
\fIlength\fR
bytes of archive.
See also
\fB\-o\fR.
.TP 13n
\fB\-n\fR
Create archive if it doesn't exist.
See also
\fB\-e\fR.
.TP 13n
\fB\-o\fR \fIoffset\fR
Start reading input archive from
\fIoffset\fR.
See also
\fB\-l\fR.
.TP 13n
\fB\-r\fR
Print raw file name encoding without translation (for
\fBstat\fR
command).
.TP 13n
\fB\-s\fR
Follow file name convention strictly (for
\fBstat\fR
command).
.TP 13n
\fB\-t\fR
Disregard current file contents, if any.
\fINote\fR:
use this with care, it deletes all existing file contents when
you modify the archive.
.SS "Commands"
For all commands below, the index is zero-based.
In other words, the first entry in the zip archive has index 0.
.PP
Supported commands and arguments are:
.TP 12n
\fBadd\fR \fIname content\fR
Add file called
\fIname\fR
using the string
\fIcontent\fR
from the command line as data.
.TP 12n
\fBadd_dir\fR \fIname\fR
Add directory
\fIname\fR.
.TP 12n
\fBadd_file\fR \fIname file_to_add offset len\fR
Add file
\fIname\fR
to archive, using
\fIlen\fR
bytes from the file
\fIfile_to_add\fR
as input data, starting at
\fIoffset\fR.
.TP 12n
\fBadd_from_zip\fR \fIname archivename index offset len\fR
Add file called
\fIname\fR
to archive using data from another zip archive
\fIarchivename\fR
using the entry with index
\fIindex\fR
and reading
\fIlen\fR
bytes from
\fIoffset\fR.
.TP 12n
\fBcat\fR \fIindex\fR
Output file contents for entry
\fIindex\fR
to stdout.
.TP 12n
\fBcount_extra\fR \fIindex flags\fR
Print the number of extra fields for archive entry
\fIindex\fR
using
\fIflags\fR.
.TP 12n
\fBcount_extra_by_id\fR \fIindex extra_id flags\fR
Print number of extra fields of type
\fIextra_id\fR
for archive entry
\fIindex\fR
using
\fIflags\fR.
.TP 12n
\fBdelete\fR \fIindex\fR
Remove entry at
\fIindex\fR
from zip archive.
.TP 12n
\fBdelete_extra\fR \fIindex extra_idx flags\fR
Remove extra field number
\fIextra_idx\fR
from archive entry
\fIindex\fR
using
\fIflags\fR.
.TP 12n
\fBdelete_extra_by_id\fR \fIindex extra_id extra_index flags\fR
Remove extra field number
\fIextra_index\fR
of type
\fIextra_id\fR
from archive entry
\fIindex\fR
using
\fIflags\fR.
.TP 12n
\fBget_archive_comment\fR
Print archive comment.
.TP 12n
\fBget_archive_flag\fR \fIflag\fR
Print state of archive flag
\fIflag\fR.
.TP 12n
\fBget_extra\fR \fIindex extra_index flags\fR
Print extra field
\fIextra_index\fR
for archive entry
\fIindex\fR
using
\fIflags\fR.
.TP 12n
\fBget_extra_by_id\fR \fIindex extra_id extra_index flags\fR
Print extra field
\fIextra_index\fR
of type
\fIextra_id\fR
for archive entry
\fIindex\fR
using
\fIflags\fR.
.TP 12n
\fBget_file_comment\fR \fIindex\fR
Get file comment for archive entry
\fIindex\fR.
.TP 12n
\fBget_num_entries\fR \fIflags\fR
Print number of entries in archive using
\fIflags\fR.
.TP 12n
\fBname_locate\fR \fIname flags\fR
Find entry in archive with the filename
\fIname\fR
using
\fIflags\fR
and print its index.
.TP 12n
\fBrename\fR \fIindex name\fR
Rename archive entry
\fIindex\fR
to
\fIname\fR.
.TP 12n
\fBreplace_file_contents\fR \fIindex data\fR
Replace file contents for archive entry
\fIindex\fR
with the string
\fIdata\fR.
.TP 12n
\fBset_archive_comment\fR \fIcomment\fR
Set archive comment to
\fIcomment\fR.
.TP 12n
\fBget_archive_flag\fR \fIflag\fR \fIvalue\fR
Set archive flag
\fIflag\fR
to
\fIvalue\fR.
.TP 12n
\fBset_extra\fR \fIindex extra_id extra_index flags value\fR
Set extra field number
\fIextra_index\fR
of type
\fIextra_id\fR
for archive entry
\fIindex\fR
using
\fIflags\fR
to
\fIvalue\fR.
.TP 12n
\fBset_file_comment\fR \fIindex comment\fR
Set file comment for archive entry
\fIindex\fR
to string
\fIcomment\fR.
.TP 12n
\fBset_file_compression\fR \fIindex method compression_flags\fR
Set file compression method for archive entry
\fIindex\fR
to
\fImethod\fR
using
\fIcompression_flags\fR.
\fINote\fR:
Currently,
\fIcompression_flags\fR
are ignored.
.TP 12n
\fBset_file_encryption\fR \fIindex method password\fR
Set file encryption method for archive entry
\fIindex\fR
to
\fImethod\fR
with password
\fIpassword\fR.
.TP 12n
\fBset_file_mtime\fR \fIindex timestamp\fR
Set file modification time for archive entry
\fIindex\fR
to UNIX mtime
\fItimestamp\fR.
.TP 12n
\fBset_file_mtime_all\fR \fItimestamp\fR
Set file modification time for all archive entries to UNIX mtime
\fItimestamp\fR.
.TP 12n
\fBset_password\fR \fIpassword\fR
Set default password for encryption/decryption to
\fIpassword\fR.
.TP 12n
\fBstat\fR \fIindex\fR
Print information about archive entry
\fIindex\fR.
.SS "Flags"
Some commands take flag arguments.
Each character in the argument sets the corresponding flag.
Use 0 or the empty string for no flags.
.PP
Supported flags are:
.RS 6n
.PD 0
.TP 5n
\fI4\fR
\fRZIP_FL_ENC_CP437\fR
.TP 5n
\fI8\fR
\fRZIP_FL_ENC_UTF_8\fR
.TP 5n
\fIC\fR
\fRZIP_FL_NOCASE\fR
.TP 5n
\fIc\fR
\fRZIP_FL_CENTRAL\fR
.TP 5n
\fId\fR
\fRZIP_FL_NODIR\fR
.TP 5n
\fIl\fR
\fRZIP_FL_LOCAL\fR
.TP 5n
\fIr\fR
\fRZIP_FL_ENC_RAW\fR
.TP 5n
\fIs\fR
\fRZIP_FL_ENC_STRICT\fR
.TP 5n
\fIu\fR
\fRZIP_FL_UNCHANGED\fR
.RE
.PD
.SS "Archive flags"
\fBget_archive_flag\fR
and
\fBset_archive_flag\fR
work on the following flags:
.RS 6n
.PD 0
.TP 4n
\fB\(bu\fR
\fRcreate-or-keep-empty-file-for-archive\fR
.TP 4n
\fB\(bu\fR
\fRis-torrentzip\fR
.TP 4n
\fB\(bu\fR
\fRrdonly\fR
.TP 4n
\fB\(bu\fR
\fRwant-torrentzip\fR
.RE
.PD
.SS "Compression Methods"
Some commands take compression method arguments.
Supported methods are:
.RS 6n
.PD 0
.TP 4n
\fB\(bu\fR
\fRdefault\fR
.TP 4n
\fB\(bu\fR
\fRdeflate\fR
.TP 4n
\fB\(bu\fR
\fRstore\fR
.RE
.PD
.SS "Encryption Methods"
Some commands take encryption method arguments.
Supported methods are:
.RS 6n
.PD 0
.TP 4n
\fB\(bu\fR
\fRnone\fR
.TP 4n
\fB\(bu\fR
\fRAES-128\fR
.TP 4n
\fB\(bu\fR
\fRAES-192\fR
.TP 4n
\fB\(bu\fR
\fRAES-256\fR
.RE
.PD
.SH "EXIT STATUS"
.br
The \fBziptool\fR utility exits\~0 on success, and\~>0 if an error occurs.
.SH "EXAMPLES"
Add a file called
\fIteststring.txt\fR
to the zip archive
\fItestbuffer.zip\fR
with data
\(lqThis is a test.\en\(rq
where
\(lq\en\(rq
is replaced with a newline character:
.nf
.sp
.RS 6n
ziptool testbuffer.zip add teststring.txt \\"This is a test.\en\\"
.RE
.fi
.PP
Delete the first file from the zip archive
\fItestfile.zip\fR:
.nf
.sp
.RS 6n
ziptool testfile.zip delete 0
.RE
.fi
.SH "SEE ALSO"
zipcmp(1),
zipmerge(1),
libzip(3)
.SH "HISTORY"
\fBziptool\fR
was added in libzip 1.1.
.SH "AUTHORS"
Dieter Baron <\fIdillo@nih.at\fR>
and
Thomas Klausner <\fIwiz@gatalith.at\fR>