third_party/libzip/src/man/ziptool.html
| ZIPTOOL(1) | General Commands Manual | ZIPTOOL(1) |
ziptool —
modify zip archives
| ziptool | [-ceghnrst] [-llength] [-ooffset] zip-archivecommand [command-args ...] [command [command-args ...] ...] |
ziptool modifies the zip archive zip-archive according to the commands given.
Supported options:
-cCheck zip archive consistency when opening it.-eError if archive already exists (only useful with -n).-gGuess file name encoding (for stat command).-hDisplay help.-llengthOnly read length bytes of archive. See also -o.-nCreate archive if it doesn't exist. See also -e.-ooffsetStart reading input archive from offset. See also -l.-rPrint raw file name encoding without translation (for stat command).-sFollow file name convention strictly (for stat command).-tDisregard current file contents, if any. Note: use this with care, it deletes all existing file contents when you modify the archive.
For all commands below, the index is zero-based. In other words, the first entry in the zip archive has index 0.
Supported commands and arguments are:
addname contentAdd file called name using the string content from the command line as data.add_dirnameAdd directory name.add_filename file_to_add offset lenAdd file name to archive, using len bytes from the file file_to_add as input data, starting at offset.add_from_zipname archivename index offset lenAdd file called name to archive using data from another zip archive archivename using the entry with index index and reading len bytes from offset.catindexOutput file contents for entry index to stdout.count_extraindex flagsPrint the number of extra fields for archive entry index using flags.count_extra_by_idindex extra_id flagsPrint number of extra fields of type extra_id for archive entry index using flags.deleteindexRemove entry at index from zip archive.delete_extraindex extra_idx flagsRemove extra field number extra_idx from archive entry index using flags.delete_extra_by_idindex extra_id extra_index flagsRemove extra field number extra_index of type extra_id from archive entry index using flags.get_archive_commentPrint archive comment.get_extraindex extra_index flagsPrint extra field extra_index for archive entry index using flags.get_extra_by_idindex extra_id extra_index flagsPrint extra field extra_index of type extra_id for archive entry index using flags.get_file_commentindexGet file comment for archive entry index.get_num_entriesflagsPrint number of entries in archive using flags.name_locatename flagsFind entry in archive with the filename name using flags and print its index.renameindex nameRename archive entry index to name.replace_file_contentsindex dataReplace file contents for archive entry index with the string data.set_archive_commentcommentSet archive comment to comment.set_extraindex extra_id extra_index flags valueSet extra field number extra_index of type extra_id for archive entry index using flags to value.set_file_commentindex commentSet file comment for archive entry index to string comment.set_file_compressionindex method compression_flagsSet file compression method for archive entry index to method using compression_flags. Note: Currently, compression_flags are ignored.set_file_encryptionindex method passwordSet file encryption method for archive entry index to method with password password.set_file_mtimeindex timestampSet file modification time for archive entry index to UNIX mtime timestamp.set_file_mtime_alltimestampSet file modification time for all archive entries to UNIX mtime timestamp.set_passwordpasswordSet default password for encryption/decryption to password.statindexPrint information about archive entry index.
Some commands take flag arguments. Supported flags are:
CZIP_FL_NOCASEcZIP_FL_CENTRALdZIP_FL_NODIRlZIP_FL_LOCALuZIP_FL_UNCHANGED
Some commands take compression method arguments. Supported methods are:
Some commands take encryption method arguments. Supported methods are:
The ziptool utility exits 0 on success, and >0 if an error occurs.
Add a file called teststring.txt to the zip archive testbuffer.zip with data “This is a test.\n” where “\n” is replaced with a newline character:
ziptool testbuffer.zip add teststring.txt \"This is a test.\n\"
Delete the first file from the zip archive testfile.zip:
ziptool testfile.zip delete 0
zipcmp(1), zipmerge(1), libzip(3)
ziptool was added in libzip 1.1.
Dieter Baron <[email protected]> and Thomas Klausner <[email protected]>
| December 18, 2017 | NiH |