Archive and package files to a gzip or pkzip format
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
QNX Neutrino, Microsoft Windows
zip -r foo . -i \*.cThis command includes only the files that end in .c in the current directory and its subdirectories.
|Don't use these options on binary files.|
|Specifying a plain-text password on the command line or in a script can be a security problem.|
zip -r foo foo -x \*.oincludes the contents of foo in foo.zip, while it excludes all the files that end in .o.
The zip utility is a compression and file-packaging utility. A companion program (unzip), unpacks zip archives. The zip and unzip programs can work with archives produced by PKZIP; PKZIP and PKUNZIP can work with archives produced by the zip utility.
The zip utility is useful for packaging a set of files for distribution, for archiving files, and for saving disk space by temporarily compressing unused files or directories.
This utility puts one or more compressed files into a single zip archive, along with information about the files, such as name, path, date, time of last modification, protection, and check information to verify file integrity.
You can use a single command to pack an entire directory structure into a zip archive. Compression ratios of 2:1 to 3:1 are common for text files. The zip utility has one compression method (deflation) and can also store files without compression; zip automatically chooses the better of the two for each file to be compressed.
When zip is given the name of an existing zip archive, it replaces identically named entries in the archive or adds entries for new names.
For example, if foo.zip exists and contains foo/file1 and foo/file2, and the directory foo contains the files foo/file1 and foo/file3, then:
zip -r foo foo
replaces foo/file1 in foo.zip and adds foo/file3 to foo.zip. Then, foo.zip contains foo/file1, foo/file2, and foo/file3; foo/file2 remains unchanged.
Create an archive called stuff.zip, for example, and put all the files in the current directory in it, in compressed form:
zip stuff *
The .zip suffix is added automatically, unless the archive name given contains a dot already; this allows the explicit specification of other suffixes.
Because of filename substitution, files starting with “.” are not included; to include these to the file:
zip stuff .* *
|This command doesn't include any subdirectories from the current directory.|
Zip up an entire directory:
zip -r foo foo
This command creates the archive foo.zip, containing all the files and directories in the directory foo that are contained within the current directory.
You may want to make a zip archive that contains the files in foo, without recording the directory name foo. Use the -j option to leave off the paths:
zip -j foo foo/*
If you're short on disk space, you might not have enough room to hold both the original directory and the corresponding compressed zip archive. In this case, you can create the archive in steps using the -m option.
For example, if foo contains the subdirectories tom, dick, and harry, you can perform these commands:
zip -rm foo foo/tom zip -rm foo foo/dick zip -rm foo foo/harry
to create a directory called foo.zip. The first command creates the foo.zip directory, and the next two commands add to it. As each zip command completes, the last created archive is deleted, making room for the next zip command to function.
freeze, gzip, pax, tar, unzip
Backing Up and Recovering Data in the Neutrino User's Guide