1ZIPTOOL(1)                BSD General Commands Manual               ZIPTOOL(1)
2

NAME

4     ziptool — modify zip archives
5

SYNOPSIS

7     ziptool [-ceghnrst] [-l length] [-o offset] zip-archive command
8             [command-args ...] [command [command-args ...] ...]
9

DESCRIPTION

11     ziptool modifies the zip archive zip-archive according to the commands
12     given.
13
14     Supported options:
15
16     -c           Check zip archive consistency when opening it.
17
18     -e           Error if archive already exists (only useful with -n).
19
20     -g           Guess file name encoding (for stat command).
21
22     -h           Display help.
23
24     -l length    Only read length bytes of archive.  See also -o.
25
26     -n           Create archive if it doesn't exist.  See also -e.
27
28     -o offset    Start reading input archive from offset.  See also -l.
29
30     -r           Print raw file name encoding without translation (for stat
31                  command).
32
33     -s           Follow file name convention strictly (for stat command).
34
35     -t           Disregard current file contents, if any.  Note: use this
36                  with care, it deletes all existing file contents when you
37                  modify the archive.
38
39   Commands
40     For all commands below, the index is zero-based.  In other words, the
41     first entry in the zip archive has index 0.
42
43     Supported commands and arguments are:
44
45     add name content
46                 Add file called name using the string content from the com‐
47                 mand line as data.
48
49     add_dir name
50                 Add directory name.
51
52     add_file name file_to_add offset len
53                 Add file name to archive, using len bytes from the file
54                 file_to_add as input data, starting at offset.
55
56     add_from_zip name archivename index offset len
57                 Add file called name to archive using data from another zip
58                 archive archivename using the entry with index index and
59                 reading len bytes from offset.
60
61     cat index   Output file contents for entry index to stdout.
62
63     count_extra index flags
64                 Print the number of extra fields for archive entry index us‐
65                 ing flags.
66
67     count_extra_by_id index extra_id flags
68                 Print number of extra fields of type extra_id for archive en‐
69                 try index using flags.
70
71     delete index
72                 Remove entry at index from zip archive.
73
74     delete_extra index extra_idx flags
75                 Remove extra field number extra_idx from archive entry index
76                 using flags.
77
78     delete_extra_by_id index extra_id extra_index flags
79                 Remove extra field number extra_index of type extra_id from
80                 archive entry index using flags.
81
82     get_archive_comment
83                 Print archive comment.
84
85     get_extra index extra_index flags
86                 Print extra field extra_index for archive entry index using
87                 flags.
88
89     get_extra_by_id index extra_id extra_index flags
90                 Print extra field extra_index of type extra_id for archive
91                 entry index using flags.
92
93     get_file_comment index
94                 Get file comment for archive entry index.
95
96     get_num_entries flags
97                 Print number of entries in archive using flags.
98
99     name_locate name flags
100                 Find entry in archive with the filename name using flags and
101                 print its index.
102
103     rename index name
104                 Rename archive entry index to name.
105
106     replace_file_contents index data
107                 Replace file contents for archive entry index with the string
108                 data.
109
110     set_archive_comment comment
111                 Set archive comment to comment.
112
113     set_extra index extra_id extra_index flags value
114                 Set extra field number extra_index of type extra_id for ar‐
115                 chive entry index using flags to value.
116
117     set_file_comment index comment
118                 Set file comment for archive entry index to string comment.
119
120     set_file_compression index method compression_flags
121                 Set file compression method for archive entry index to method
122                 using compression_flags.  Note: Currently, compression_flags
123                 are ignored.
124
125     set_file_encryption index method password
126                 Set file encryption method for archive entry index to method
127                 with password password.
128
129     set_file_mtime index timestamp
130                 Set file modification time for archive entry index to UNIX
131                 mtime timestamp.
132
133     set_file_mtime_all timestamp
134                 Set file modification time for all archive entries to UNIX
135                 mtime timestamp.
136
137     set_password password
138                 Set default password for encryption/decryption to password.
139
140     stat index  Print information about archive entry index.
141
142   Flags
143     Some commands take flag arguments. Each character in the argument sets
144     the corresponding flag. Use 0 or the empty string for no flags.
145
146     Supported flags are:
147           4    ZIP_FL_ENC_CP437
148           8    ZIP_FL_ENC_UTF_8
149           C    ZIP_FL_NOCASE
150           c    ZIP_FL_CENTRAL
151           d    ZIP_FL_NODIR
152           l    ZIP_FL_LOCAL
153           r    ZIP_FL_ENC_RAW
154           s    ZIP_FL_ENC_STRICT
155           u    ZIP_FL_UNCHANGED
156
157   Compression Methods
158     Some commands take compression method arguments.  Supported methods are:
159           default
160           deflate
161           store
162
163   Encryption Methods
164     Some commands take encryption method arguments.  Supported methods are:
165           none
166           AES-128
167           AES-192
168           AES-256
169

EXIT STATUS

171     The ziptool utility exits 0 on success, and >0 if an error occurs.
172

EXAMPLES

174     Add a file called teststring.txt to the zip archive testbuffer.zip with
175     data “This is a test.\n” where “\n” is replaced with a newline character:
176
177           ziptool testbuffer.zip add teststring.txt \"This is a test.\n\"
178
179     Delete the first file from the zip archive testfile.zip:
180
181           ziptool testfile.zip delete 0
182

SEE ALSO

184     zipcmp(1), zipmerge(1), libzip(3)
185

HISTORY

187     ziptool was added in libzip 1.1.
188

AUTHORS

190     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
191
192BSD                             March 15, 2022                             BSD
Impressum