.TH "ZIPTOOL" "1" "January 19, 2016" "NiH" "General Commands Manual" .nh .if n .ad l .SH "NAME" \fBziptool\fR \- modify zip archives .SH "SYNOPSIS" .HP 8n \fBziptool\fR [\fB\-cegHhmnrst\fR] \fIzip-archive\fR \fBcommand\fR\ [\fIcommand-args\ ...\fR] [\fBcommand\fR\ [\fIcommand-args\ ...\fR]\ ...] .SH "DESCRIPTION" \fBziptool\fR modifies the zip archive \fIzip-archive\fR according to the \fIcommands\fR given. .PP Supported options: .TP 5n \fB\-c\fR Check zip archive consistency when opening it. .TP 5n \fB\-e\fR Error if archive already exists (only useful with \fB\-n\fR). .TP 5n \fB\-g\fR Guess file name encoding (for \fBstat\fR command). .TP 5n \fB\-H\fR Write files with \(Lqholes\(Rq compactly. In other words, when the modified zip archive contains long runs of zeroes, write a basic run-length encoded block instead. \fINote\fR: This command is for internal testing of libzip(3) and will usually create invalid zip archives. .TP 5n \fB\-h\fR Display help. .TP 5n \fB\-m\fR Read archive into memory, and modify there; write out at end. \fINote\fR: This command is for internal testing of libzip(3). .TP 5n \fB\-n\fR Create archive if it doesn't exist. See also \fB\-e\fR. .TP 5n \fB\-r\fR Print raw file name encoding without translation (for \fBstat\fR command). .TP 5n \fB\-s\fR Follow file name convention strictly (for \fBstat\fR command). .TP 5n \fB\-t\fR Disregard current file contents, if any. \fINote\fR: use this with care, it deletes all existing file contents when you modify the archive. .SS "Commands" For all commands below, the index is zero-based. In other words, the first entry in the zip archive has index 0. .PP Supported commands and arguments are: .TP 12n \fBadd\fR \fIname content\fR Add file called \fIname\fR using the string \fIcontent\fR from the command line as data. .TP 12n \fBadd_dir\fR \fIname\fR Add directory \fIname\fR. .TP 12n \fBadd_file\fR \fIname file_to_add offset len\fR Add file \fIname\fR to archive, using \fIlen\fR bytes from the file \fIfile_to_add\fR as input data, starting at \fIoffset\fR. .TP 12n \fBadd_from_zip\fR \fIname archivename index offset len\fR Add file called \fIname\fR to archive using data from another zip archive \fIarchivename\fR using the entry with index \fIindex\fR and reading \fIlen\fR bytes from \fIoffset\fR. .TP 12n \fBadd_nul\fR \fIname length\fR Add a file \fIname\fR consisting of \fIlength\fR NUL bytes. (Mostly useful for testing.) .TP 12n \fBcat\fR \fIindex\fR Output file contents for entry \fIindex\fR to stdout. .TP 12n \fBcount_extra\fR \fIindex flags\fR Print the number of extra fields for archive entry \fIindex\fR using \fIflags\fR. .TP 12n \fBcount_extra_by_id\fR \fIindex extra_id flags\fR Print number of extra fields of type \fIextra_id\fR for archive entry \fIindex\fR using \fIflags\fR. .TP 12n \fBdelete\fR \fIindex\fR Remove entry at \fIindex\fR from zip archive. .TP 12n \fBdelete_extra\fR \fIindex extra_idx flags\fR Remove extra field number \fIextra_idx\fR from archive entry \fIindex\fR using \fIflags\fR. .TP 12n \fBdelete_extra_by_id\fR \fIindex extra_id extra_index flags\fR Remove extra field number \fIextra_index\fR of type \fIextra_id\fR from archive entry \fIindex\fR using \fIflags\fR. .TP 12n \fBget_archive_comment\fR Print archive comment. .TP 12n \fBget_extra\fR \fIindex extra_index flags\fR Print extra field \fIextra_index\fR for archive entry \fIindex\fR using \fIflags\fR. .TP 12n \fBget_extra_by_id\fR \fIindex extra_id extra_index flags\fR Print extra field \fIextra_index\fR of type \fIextra_id\fR for archive entry \fIindex\fR using \fIflags\fR. .TP 12n \fBget_file_comment\fR \fIindex\fR Get file comment for archive entry \fIindex\fR. .TP 12n \fBget_num_entries\fR \fIflags\fR Print number of entries in archive using \fIflags\fR. .TP 12n \fBname_locate\fR \fIname flags\fR Find entry in archive with the filename \fIname\fR using \fIflags\fR and print its index. .TP 12n \fBrename\fR \fIindex name\fR Rename archive entry \fIindex\fR to \fIname\fR. .TP 12n \fBreplace_file_contents\fR \fIindex data\fR Replace file contents for archive entry \fIindex\fR with the string \fIdata\fR. .TP 12n \fBset_archive_comment\fR \fIcomment\fR Set archive comment to \fIcomment\fR. .TP 12n \fBset_extra\fR \fIindex extra_id extra_index flags value\fR Set extra field number \fIextra_index\fR of type \fIextra_id\fR for archive entry \fIindex\fR using \fIflags\fR to \fIvalue\fR. .TP 12n \fBset_file_comment\fR \fIindex comment\fR Set file comment for archive entry \fIindex\fR to string \fIcomment\fR. .TP 12n \fBset_file_compression\fR \fIindex method compression_flags\fR Set file compression method for archive entry \fIindex\fR to \fImethod\fR using \fIcompression_flags\fR. \fINote\fR: Currently, \fIcompression_flags\fR are ignored. .TP 12n \fBset_file_mtime\fR \fIindex timestamp\fR Set file modification time for archive entry \fIindex\fR to UNIX mtime \fItimestamp\fR. .TP 12n \fBset_file_mtime_all\fR \fItimestamp\fR Set file modification time for all archive entries to UNIX mtime \fItimestamp\fR. .TP 12n \fBset_password\fR \fIpassword\fR Set default password for encryption/decryption to \fIpassword\fR. .TP 12n \fBstat\fR \fIindex\fR Print information about archive entry \fIindex\fR. .TP 12n \fBunchange_all\fR Revert all changes up to that point. Mostly useful for testing. .TP 12n \fBzin_close\fR \fIindex\fR Close input zip_source \fIindex\fR. For internal tests only. .SS "Flags" Some commands take flag arguments. Supported flags are: .RS 6n .PD 0 .TP 5n \fIC\fR \fRZIP_FL_NOCASE\fR .TP 5n \fIc\fR \fRZIP_FL_CENTRAL\fR .TP 5n \fId\fR \fRZIP_FL_NODIR\fR .TP 5n \fIl\fR \fRZIP_FL_LOCAL\fR .TP 5n \fIu\fR \fRZIP_FL_UNCHANGED\fR .RE .PD .SS "Compression Methods" Some commands take compression method arguments. Supported methods are: .RS 6n .PD 0 .TP 4n \fB\(bu\fR \fRdefault\fR .TP 4n \fB\(bu\fR \fRdeflate\fR .TP 4n \fB\(bu\fR \fRstore\fR .RE .PD .SH "EXIT STATUS" .br The \fBziptool\fR utility exits\~0 on success, and\~>0 if an error occurs. .SH "EXAMPLES" Add a file called \fIteststring.txt\fR to the zip archive \fItestbuffer.zip\fR with data \(LqThis is a test.\en\(Rq where \(Lq\en\(Rq is replaced with a newline character: .nf .sp .RS 6n ziptool testbuffer.zip add teststring.txt \\"This is a test.\en\\" .RE .fi .PP Delete the first file from the zip archive \fItestfile.zip\fR: .nf .sp .RS 6n ziptool testfile.zip delete 0 .RE .fi .SH "SEE ALSO" zipcmp(1), zipmerge(1), libzip(3) .SH "AUTHORS" Dieter Baron <\fIdillo@nih.at\fR> and Thomas Klausner <\fItk@giga.or.at\fR>