1ZIPTOOL(1) BSD General Commands Manual ZIPTOOL(1)
2
4 ziptool — modify zip archives
5
7 ziptool [-ceghnrst] [-l length] [-o offset] zip-archive command
8 [command-args ...] [command [command-args ...] ...]
9
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
65 using flags.
66
67 count_extra_by_id index extra_id flags
68 Print number of extra fields of type extra_id for archive
69 entry 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. Supported flags are:
144 C ZIP_FL_NOCASE
145 c ZIP_FL_CENTRAL
146 d ZIP_FL_NODIR
147 l ZIP_FL_LOCAL
148 u ZIP_FL_UNCHANGED
149
150 Compression Methods
151 Some commands take compression method arguments. Supported methods are:
152 · default
153 · deflate
154 · store
155
156 Encryption Methods
157 Some commands take encryption method arguments. Supported methods are:
158 · none
159 · AES-128
160 · AES-192
161 · AES-256
162
164 The ziptool utility exits 0 on success, and >0 if an error occurs.
165
167 Add a file called teststring.txt to the zip archive testbuffer.zip with
168 data “This is a test.\n” where “\n” is replaced with a newline character:
169
170 ziptool testbuffer.zip add teststring.txt \"This is a test.\n\"
171
172 Delete the first file from the zip archive testfile.zip:
173
174 ziptool testfile.zip delete 0
175
177 zipcmp(1), zipmerge(1), libzip(3)
178
180 ziptool was added in libzip 1.1.
181
183 Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
184
185BSD December 18, 2017 BSD