1 .\" ziptool.mdoc -- modify zip archives in multiple ways
2 .\" Copyright (C) 2016-2017 Dieter Baron and Thomas Klausner
4 .\" This file is part of libzip, a library to manipulate ZIP archives.
5 .\" The authors can be contacted at <libzip@nih.at>
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in
14 .\" the documentation and/or other materials provided with the
16 .\" 3. The names of the authors may not be used to endorse or promote
17 .\" products derived from this software without specific prior
18 .\" written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
21 .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
24 .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
28 .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
30 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 .Nd modify zip archives
44 .Cm command Op Ar command-args ...
45 .Op Cm command Oo Ar command-args ... Oc ...
48 modifies the zip archive
55 .Bl -tag -width MoMoffsetMM
57 Check zip archive consistency when opening it.
59 Error if archive already exists (only useful with
62 Guess file name encoding (for
74 Create archive if it doesn't exist.
78 Start reading input archive from
83 Print raw file name encoding without translation (for
87 Follow file name convention strictly (for
91 Disregard current file contents, if any.
93 use this with care, it deletes all existing file contents when
94 you modify the archive.
97 For all commands below, the index is zero-based.
98 In other words, the first entry in the zip archive has index 0.
100 Supported commands and arguments are:
102 .It Cm add Ar name content
107 from the command line as data.
108 .It Cm add_dir Ar name
111 .It Cm add_file Ar name file_to_add offset len
118 as input data, starting at
120 .It Cm add_from_zip Ar name archivename index offset len
123 to archive using data from another zip archive
125 using the entry with index
132 Output file contents for entry
135 .It Cm count_extra Ar index flags
136 Print the number of extra fields for archive entry
140 .It Cm count_extra_by_id Ar index extra_id flags
141 Print number of extra fields of type
147 .It Cm delete Ar index
151 .It Cm delete_extra Ar index extra_idx flags
152 Remove extra field number
158 .It Cm delete_extra_by_id Ar index extra_id extra_index flags
159 Remove extra field number
167 .It Cm get_archive_comment
168 Print archive comment.
169 .It Cm get_extra Ar index extra_index flags
176 .It Cm get_extra_by_id Ar index extra_id extra_index flags
185 .It Cm get_file_comment Ar index
186 Get file comment for archive entry
188 .It Cm get_num_entries Ar flags
189 Print number of entries in archive using
191 .It Cm name_locate Ar name flags
192 Find entry in archive with the filename
197 .It Cm rename Ar index name
202 .It Cm replace_file_contents Ar index data
203 Replace file contents for archive entry
207 .It Cm set_archive_comment Ar comment
208 Set archive comment to
210 .It Cm set_extra Ar index extra_id extra_index flags value
211 Set extra field number
221 .It Cm set_file_comment Ar index comment
222 Set file comment for archive entry
226 .It Cm set_file_compression Ar index method compression_flags
227 Set file compression method for archive entry
232 .Ar compression_flags .
235 .Ar compression_flags
237 .It Cm set_file_encryption Ar index method password
238 Set file encryption method for archive entry
244 .It Cm set_file_mtime Ar index timestamp
245 Set file modification time for archive entry
249 .It Cm set_file_mtime_all Ar timestamp
250 Set file modification time for all archive entries to UNIX mtime
252 .It Cm set_password Ar password
253 Set default password for encryption/decryption to
256 Print information about archive entry
260 Some commands take flag arguments.
262 .Bl -tag -width MMM -compact -offset indent
274 .Ss Compression Methods
275 Some commands take compression method arguments.
276 Supported methods are:
277 .Bl -bullet -compact -offset indent
285 .Ss Encryption Methods
286 Some commands take encryption method arguments.
287 Supported methods are:
288 .Bl -bullet -compact -offset indent
306 .Dq This is a test.\en
309 is replaced with a newline character:
310 .Bd -literal -offset indent
311 ziptool testbuffer.zip add teststring.txt \\"This is a test.\en\\"
314 Delete the first file from the zip archive
316 .Bd -literal -offset indent
317 ziptool testfile.zip delete 0
325 was added in libzip 1.1.
328 .An Dieter Baron Aq Mt dillo@nih.at
330 .An Thomas Klausner Aq Mt tk@giga.or.at