ZIPTOOL(1)
π ZIPTOOL(1) π
hey bestie!! so this is the manual page for ziptool β it lives in the General Commands Manual section, and it is literally the little gadget that lets you poke at a zip archive from the command line. buckle up, it's giving β¨chaos goblinβ¨ in the best way π
β¨ NAME β¨
ziptool β modify zip archives. that's it, that's the whole job. she modifies zips. π
πΈ SYNOPSIS πΈ
ziptool [-ceghnrst] [-l length] [-o offset] zip-archive command
[command-args ...] [command [command-args ...] ...]
okay so it's the flags, then your zip-archive, then one or more commands, each one optionally followed by its own little pile of arguments. stack 'em up, bestie π«Ά
π¦ DESCRIPTION π¦
ziptool modifies the zip archive zip-archive according to the commands given. no cap, that's the entire personality.
Supported options:
-cβ Check zip archive consistency when opening it. π-eβ Error if archive already exists (only useful with-n). like, don't touch it if it's already there, tyvm.-gβ Guess file name encoding (forstatcommand).-hβ Display help. π«Ά-llength β Only read length bytes of archive. See also-o.-nβ Create archive if it doesn't exist. See also-e. β¨-ooffset β Start reading input archive from offset. See also-l.-rβ Print raw file name encoding without translation (forstatcommand).-sβ Follow file name convention strictly (forstatcommand).-tβ Disregard current file contents, if any.
β οΈ bestie listen to me: use -t with care β it deletes all existing file contents when you modify the archive. like, gone gone. π
π Commands π
For all commands below, the index is zero-based. In other words, the first entry in the zip archive has index 0. yes, zero. the first one is zero. i don't make the rules, i just think they're iconic. π
Supported commands and arguments are:
addname content β Add file called name using the string content from the command line as data.add_dirname β Add directory name.add_filename file_to_add offset len β Add 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 len β Add file called name to archive using data from another zip archive archivename using the entry with index index and reading len bytes from offset. π«Ά stealing, but politely.catindex β Output file contents for entry index to stdout.count_extraindex flags β Print the number of extra fields for archive entry index using flags.count_extra_by_idindex extra_id flags β Print number of extra fields of type extra_id for archive entry index using flags.deleteindex β Remove entry at index from zip archive.delete_extraindex extra_idx flags β Remove extra field number extra_idx from archive entry index using flags.delete_extra_by_idindex extra_id extra_index flags β Remove extra field number extra_index of type extra_id from archive entry index using flags.get_archive_commentβ Print archive comment.get_archive_flagflag β Print state of archive flag flag.get_extraindex extra_index flags β Print extra field extra_index for archive entry index using flags.get_extra_by_idindex extra_id extra_index flags β Print extra field extra_index of type extra_id for archive entry index using flags.get_file_commentindex β Get file comment for archive entry index.get_num_entriesflags β Print number of entries in archive using flags.name_locatename flags β Find entry in archive with the filename name using flags and print its index.renameindex name β Rename archive entry index to name.replace_file_contentsindex data β Replace file contents for archive entry index with the string data.set_archive_commentcomment β Set archive comment to comment.get_archive_flagflag value β Set archive flag flag to value.set_extraindex extra_id extra_index flags value β Set extra field number extra_index of type extra_id for archive entry index using flags to value.set_file_commentindex comment β Set file comment for archive entry index to string comment.set_file_compressionindex method compression_flags β Set file compression method for archive entry index to method using compression_flags. Note: Currently, compression_flags are ignored. π (she's just standing there. not being used. iconic.)set_file_encryptionindex method password β Set file encryption method for archive entry index to method with password password. πset_file_mtimeindex timestamp β Set file modification time for archive entry index to UNIX mtime timestamp.set_file_mtime_alltimestamp β Set file modification time for all archive entries to UNIX mtime timestamp. β° all of them. at once. slay.set_passwordpassword β Set default password for encryption/decryption to password.statindex β Print information about archive entry index. π
π§ Flags π§
Some commands take flag arguments. Each character in the argument sets the corresponding flag. Use 0 or the empty string for no flags. π zero flags, zero thoughts, head empty.
Supported flags are:
4βZIP_FL_ENC_CP4378βZIP_FL_ENC_UTF_8CβZIP_FL_NOCASEcβZIP_FL_CENTRALdβZIP_FL_NODIRlβZIP_FL_LOCALrβZIP_FL_ENC_RAWsβZIP_FL_ENC_STRICTuβZIP_FL_UNCHANGED
π pspsps bestie: those are case-sensitive.Candcare two completely different girls. don't mix them up.
π Archive flags π
get_archive_flag and set_archive_flag work on the following flags:
create-or-keep-empty-file-for-archiveis-torrentziprdonlywant-torrentzip
π Compression Methods π
Some commands take compression method arguments. Supported methods are:
defaultdeflatestore
π Encryption Methods π
Some commands take encryption method arguments. Supported methods are:
noneAES-128AES-192AES-256
β EXIT STATUS β
The ziptool utility exits 0 on success, and >0 if an error occurs. zero = we ate. anything else = we did not eat. π
π₯ EXAMPLES π₯
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
see that 0? first file. zero-based. i told you. π«Ά
π SEE ALSO π
π HISTORY π
ziptool was added in libzip 1.1. a classic. a legend. a pioneer. β¨
π AUTHORS π
Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at> β the icons who built her π
okay that's the whole page bestie, mwah π this beauty shipped from Debian on January 23, 2023 β go forth and modify some zip archives, you absolute main character ππ¦π
π¦ where this page comes from
- arch rolling: libzip 1.11.4-1 Β· BSD
- debian trixie: ziptool 1.11.3-2 Β· BSD-3-Clause
- fedora 43: libzip-tools 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 44: libzip-tools 1.11.4-3.fc44 Β· BSD-3-Clause
- nixpkgs unstable: libzip 1.11.4
- ubuntu questing: ziptool 1.11.3-2
- ubuntu resolute: ziptool 1.11.4-2 Β· BSD-3-Clause
- ubuntu stonking: ziptool 1.11.4-2build1 Β· BSD-3-Clause
- Copyright (C) 2016-2022 Dieter Baron and Thomas Klausner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms