new one. If this operation fails, zip attempts to restore the
archive to its original state. If the restoration fails, the
archive might become corrupted. This option is ignored when
there’s no existing archive or when at least one archive member
must be updated or deleted.
-h
-?
--help
Display the zip help information (this also appears if zip is run
with no arguments).
-h2
--more‐help
Display extended help including more on command line format, pat‐
tern matching, and more obscure options.
-i files
--include files
Include only the specified files, as in:
zip ‐r foo . ‐i \*.c
which will include only the files that end in .c in the current
directory and its subdirectories. (Note for PKZIP users: the
equivalent command is
pkzip ‐rP foo *.c
PKZIP does not allow recursion in directories other than the cur‐
rent one.) The backslash avoids the shell filename substitution,
so that the name matching is performed by zip at all directory
levels. [This is for Unix and other systems where \ escapes the
next character. For other systems where the shell does not
process * do not use \ and the above is
zip ‐r foo . ‐i *.c
Examples are for Unix unless otherwise specified.] So to include
dir, a directory directly under the current directory, use
zip ‐r foo . ‐i dir/\*
or
zip ‐r foo . ‐i "dir/*"
to match paths such as dir/a and dir/b/file.c [on ports without
wildcard expansion in the shell such as MSDOS and Windows
zip ‐r foo . ‐i dir/*
is used.] Note that currently the trailing / is needed for di‐
rectories (as in
zip ‐r foo . ‐i dir/
to include directory dir).
The long option form of the first example is
zip ‐r foo . ‐‐include \*.c
and does the same thing as the short option form.
Though the command syntax used to require ‐i at the end of the
command line, this version actually allows -i (or --include) any‐
where. The list of files terminates at the next argument start‐
ing with ‐, the end of the command line, or the list terminator @
(an argument that is just @). So the above can be given as
zip ‐i \*.c @ ‐r foo .
for example. There must be a space between the option and the
first file of a list. For just one file you can use the single
value form
zip ‐i\*.c ‐r foo .
(no space between option and value) or
zip ‐‐include=\*.c ‐r foo .
as additional examples. The single value forms are not recom‐
mended because they can be confusing and, in particular, the
-ifile format can cause problems if the first letter of file com‐
bines with i to form a two‐letter option starting with i. Use
-sc to see how your command line will be parsed.
Also possible:
zip ‐r foo . ‐i@include.lst
which will only include the files in the current directory and
its subdirectories that match the patterns in the file in‐
clude.lst.
Files to -i and -x are patterns matching internal archive paths.
See ‐R for more on patterns.
-I
--no‐image
[Acorn RISC OS] Don’t scan through Image