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_archive_flag flag
86                 Print state of archive flag flag.
87
88     get_extra index extra_index flags
89                 Print extra field extra_index for archive entry index using
90                 flags.
91
92     get_extra_by_id index extra_id extra_index flags
93                 Print extra field extra_index of type extra_id for archive
94                 entry index using flags.
95
96     get_file_comment index
97                 Get file comment for archive entry index.
98
99     get_num_entries flags
100                 Print number of entries in archive using flags.
101
102     name_locate name flags
103                 Find entry in archive with the filename name using flags and
104                 print its index.
105
106     rename index name
107                 Rename archive entry index to name.
108
109     replace_file_contents index data
110                 Replace file contents for archive entry index with the string
111                 data.
112
113     set_archive_comment comment
114                 Set archive comment to comment.
115
116     get_archive_flag flag value
117                 Set archive flag flag to value.
118
119     set_extra index extra_id extra_index flags value
120                 Set extra field number extra_index of type extra_id for ar‐
121                 chive entry index using flags to value.
122
123     set_file_comment index comment
124                 Set file comment for archive entry index to string comment.
125
126     set_file_compression index method compression_flags
127                 Set file compression method for archive entry index to method
128                 using compression_flags.  Note: Currently, compression_flags
129                 are ignored.
130
131     set_file_encryption index method password
132                 Set file encryption method for archive entry index to method
133                 with password password.
134
135     set_file_mtime index timestamp
136                 Set file modification time for archive entry index to UNIX
137                 mtime timestamp.
138
139     set_file_mtime_all timestamp
140                 Set file modification time for all archive entries to UNIX
141                 mtime timestamp.
142
143     set_password password
144                 Set default password for encryption/decryption to password.
145
146     stat index  Print information about archive entry index.
147
148   Flags
149     Some commands take flag arguments. Each character in the argument sets
150     the corresponding flag. Use 0 or the empty string for no flags.
151
152     Supported flags are:
153           4    ZIP_FL_ENC_CP437
154           8    ZIP_FL_ENC_UTF_8
155           C    ZIP_FL_NOCASE
156           c    ZIP_FL_CENTRAL
157           d    ZIP_FL_NODIR
158           l    ZIP_FL_LOCAL
159           r    ZIP_FL_ENC_RAW
160           s    ZIP_FL_ENC_STRICT
161           u    ZIP_FL_UNCHANGED
162
163   Archive flags
164     get_archive_flag and set_archive_flag work on the following flags:
165           create-or-keep-empty-file-for-archive
166           is-torrentzip
167           rdonly
168           want-torrentzip
169
170   Compression Methods
171     Some commands take compression method arguments.  Supported methods are:
172           default
173           deflate
174           store
175
176   Encryption Methods
177     Some commands take encryption method arguments.  Supported methods are:
178           none
179           AES-128
180           AES-192
181           AES-256
182

EXIT STATUS

184     The ziptool utility exits 0 on success, and >0 if an error occurs.
185

EXAMPLES

187     Add a file called teststring.txt to the zip archive testbuffer.zip with
188     data “This is a test.\n” where “\n” is replaced with a newline character:
189
190           ziptool testbuffer.zip add teststring.txt \"This is a test.\n\"
191
192     Delete the first file from the zip archive testfile.zip:
193
194           ziptool testfile.zip delete 0
195

SEE ALSO

197     zipcmp(1), zipmerge(1), libzip(3)
198

HISTORY

200     ziptool was added in libzip 1.1.
201

AUTHORS

203     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
204
205BSD                            January 23, 2023                            BSD
Impressum