NAME
zip - package and compress files into a ZIP archive

SYNOPSIS
zip [OPTION...] ZIPFILE FILE...

DESCRIPTION
zip compresses and packs FILE(s) into a single ZIP archive that is compatible with PKZIP. By default, packing a directory to a ZIPFILE always implies that the subdirectories below should be included in the archive.

OPTIONS
-i 'PATTERN[, PATTERN...]'
Include only those files that match the specified PATTERN(s).

-x 'PATTERN[, PATTERN...]'
Exclude files that match the specified PATTERN(s).
 
EXAMPLE
To archive a directory, including its subdirectories, into a ZIPFILE:
zip data.zip data_dir

To archive a directory, excluding the content of its subdirectories, into a ZIPFILE:
zip -i '*' data.zip data_dir


To archive a directory and its subdirectories into a ZIPFILE without including all of files end with .txt and .html suffixes:
zip -x '**/*.txt, **/*.html' data.zip data_dir


To archive a directory and its subdirectories into a ZIPFILE, excluding those files end with .dat suffix in the sub_dir_1 directory:
zip -x '**/sub_dir_1/*.dat' data.zip data_dir


NOTES
      zip command terminates with an error if all of specified FILEs are directories and all of them are empty.

      Execution of zip command would fail if invalid patterns are specified by -x and -i options, or, valid patterns are specified but cause conflict or all of files are excluded by the specified patterns. When this happens, zip terminates with one line message without detail information provided.

      SEE ALSO
      unzip
      tar
      gzip
      gunzip
 



  • No labels