logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

ziptool — modify zip archives

Authors

       Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at>

Debian                                          January 23, 2023                                      ZIPTOOL(1)

Description

ziptool modifies the zip archive zip-archive according to the commands given.

       Supported options:

       -c           Check zip archive consistency when opening it.

       -e           Error if archive already exists (only useful with -n).

       -g           Guess file name encoding (for stat command).

       -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 (for stat command).

       -s           Follow file name convention strictly (for stat command).

       -t           Disregard current file contents, if any.  Note: use this with care, it deletes all  existing
                    file contents when you modify the archive.

   Commands
       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:

       addnamecontent
                   Add file called name using the string content from the command line as data.

       add_dirname
                   Add directory name.

       add_filenamefile_to_addoffsetlen
                   Add file name to archive, using len bytes from the file file_to_add as input  data,  starting
                   at offset.

       add_from_zipnamearchivenameindexoffsetlen
                   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.

       catindex   Output file contents for entry index to stdout.

       count_extraindexflags
                   Print the number of extra fields for archive entry index using flags.

       count_extra_by_idindexextra_idflags
                   Print number of extra fields of type extra_id for archive entry index using flags.

       deleteindex
                   Remove entry at index from zip archive.

       delete_extraindexextra_idxflags
                   Remove extra field number extra_idx from archive entry index using flags.

       delete_extra_by_idindexextra_idextra_indexflags
                   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_extraindexextra_indexflags
                   Print extra field extra_index for archive entry index using flags.

       get_extra_by_idindexextra_idextra_indexflags
                   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_locatenameflags
                   Find entry in archive with the filename name using flags and print its index.

       renameindexname
                   Rename archive entry index to name.

       replace_file_contentsindexdata
                   Replace file contents for archive entry index with the string data.

       set_archive_commentcomment
                   Set archive comment to comment.

       get_archive_flagflagvalue
                   Set archive flag flag to value.

       set_extraindexextra_idextra_indexflagsvalue
                   Set extra field number extra_index of type extra_id for archive entry index  using  flags  to
                   value.

       set_file_commentindexcomment
                   Set file comment for archive entry index to string comment.

       set_file_compressionindexmethodcompression_flags
                   Set file compression method for archive entry index to method using compression_flags.  Note:
                   Currently, compression_flags are ignored.

       set_file_encryptionindexmethodpassword
                   Set file encryption method for archive entry index to method with password password.

       set_file_mtimeindextimestamp
                   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.

       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.

       Supported flags are:
             4    ZIP_FL_ENC_CP437
             8    ZIP_FL_ENC_UTF_8
             C    ZIP_FL_NOCASE
             c    ZIP_FL_CENTRAL
             d    ZIP_FL_NODIR
             l    ZIP_FL_LOCAL
             r    ZIP_FL_ENC_RAW
             s    ZIP_FL_ENC_STRICT
             u    ZIP_FL_UNCHANGED

   Archiveflagsget_archive_flag and set_archive_flag work on the following flags:
                create-or-keep-empty-file-for-archive
                is-torrentzip
                rdonly
                want-torrentzip

   CompressionMethods
       Some commands take compression method arguments.  Supported methods are:
                default
                deflate
                store

   EncryptionMethods
       Some commands take encryption method arguments.  Supported methods are:
                none
                AES-128
                AES-192
                AES-256

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

Exit Status

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

History

ziptool was added in libzip 1.1.

Name

       ziptool — modify zip archives

See Also

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

Synopsis

ziptool    [-ceghnrst]    [-llength]    [-ooffset]   zip-archivecommand   [command-args...]
               [command [command-args...] ...]

See Also