Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
ZIPTOOL(1)		  BSD General Commands Manual		    ZIPTOOL(1)

     ziptool --	modify zip archives

     ziptool [-cegHhmnrst] zip-archive command [command-args ...]
	     [command [command-args ...] ...]

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

     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	  Write	files with "holes" compactly.  In other	words, when the	modi-
	  fied zip archive contains long runs of zeroes, write a basic run-
	  length encoded block instead.	 Note: This command is for internal
	  testing of libzip(3) and will	usually	create invalid zip archives.

     -h	  Display help.

     -m	  Read archive into memory, and	modify there; write out	at end.	 Note:
	  This command is for internal testing of libzip(3).

     -n	  Create archive if it doesn't exist.  See also	-e.

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

     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:

     add name content
		 Add file called name using the	string content from the	com-
		 mand line as data.

     add_dir name
		 Add directory name.

     add_file name 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_zip name 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.

     add_nul name length
		 Add a file name consisting of length NUL bytes.  (Mostly use-
		 ful for testing.)

     cat index	 Output	file contents for entry	index to stdout.

     count_extra index flags
		 Print the number of extra fields for archive entry index us-
		 ing flags.

     count_extra_by_id index extra_id flags
		 Print number of extra fields of type extra_id for archive en-
		 try index using flags.

     delete index
		 Remove	entry at index from zip	archive.

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

     delete_extra_by_id	index extra_id extra_index flags
		 Remove	extra field number extra_index of type extra_id	from
		 archive entry index using flags.

		 Print archive comment.

     get_extra index extra_index flags
		 Print extra field extra_index for archive entry index using

     get_extra_by_id index extra_id extra_index	flags
		 Print extra field extra_index of type extra_id	for archive
		 entry index using flags.

     get_file_comment index
		 Get file comment for archive entry index.

     get_num_entries flags
		 Print number of entries in archive using flags.

     name_locate name flags
		 Find entry in archive with the	filename name using flags and
		 print its index.

     rename index name
		 Rename	archive	entry index to name.

     replace_file_contents index data
		 Replace file contents for archive entry index with the	string

     set_archive_comment comment
		 Set archive comment to	comment.

     set_extra index extra_id extra_index flags	value
		 Set extra field number	extra_index of type extra_id for ar-
		 chive entry index using flags to value.

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

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

     set_file_mtime index timestamp
		 Set file modification time for	archive	entry index to UNIX
		 mtime timestamp.

     set_file_mtime_all	timestamp
		 Set file modification time for	all archive entries to UNIX
		 mtime timestamp.

     set_password password
		 Set default password for encryption/decryption	to password.

     stat index	 Print information about archive entry index.

		 Revert	all changes up to that point.  Mostly useful for test-

     zin_close index
		 Close input zip_source	index.	For internal tests only.

     Some commands take	flag arguments.	 Supported flags are:

   Compression Methods
     Some commands take	compression method arguments.  Supported methods are:
	   +o   default
	   +o   deflate
	   +o   store

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

     Add a file	called teststring.txt to the zip archive	with
     data "This	is a test.\n" where "\n" is replaced with a newline character:

	   ziptool add teststring.txt \"This is a test.\n\"

     Delete the	first file from	the zip	archive

	   ziptool	delete 0

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

     Dieter Baron <> and Thomas Klausner <>

BSD			       January 19, 2016				   BSD


Want to link to this manual page? Use this URL:

home | help