set the split size and create a split archive. The size is
given as a number followed optionally by one of k (kB), m (MB), g (GB),
or t (TB). The command
zip ‐s 2g ‐r split.zip foo
creates a split archive of the directory foo with splits no bigger than
2 GB each. If foo contained 5 GB of contents and the contents were
stored in the split archive without compression (to make this example
simple), this would create three splits, split.z01 at 2 GB, split.z02 at
2 GB, and split.zip at a little over 1 GB.
The -sp option can be used to pause zip between splits to allow changing
removable media, for example, but read the descriptions and warnings for
both -s and -sp below.
Though zip does not update split archives, zip provides the new option
-O (--output-file) to allow split archives to be updated and saved in a
new archive. For example,
zip inarchive.zip foo.c bar.c --out outarchive.zip
reads archive inarchive.zip, even if split, adds the files foo.c and
bar.c, and writes the resulting archive to outarchive.zip. If inar‐
chive.zip is split then outarchive.zip defaults to the same split size.
Be aware that outarchive.zip and any split files that are created with
it are always overwritten without warning. This may be changed in the
future.
PATTERN MATCHING
This section applies only to Unix. Watch this space for details on MS‐
DOS and VMS operation. However, the special wildcard characters * and
[] below apply to at least MSDOS also.
The Unix shells (sh, csh, bash, and others) normally do filename substi‐
tution (also called "globbing") on command arguments. Generally the
special characters are:
? match any single character
* match any number of characters (including none)
[] match any character in the range indicated within the brackets
(example: [a-f], [0-9]). This form of wildcard matching allows a
user to specify a list of characters between square brackets and
if any of the characters match the expression matches. For exam‐
ple:
zip archive "*.[hc]"
would archive all files in the current directory that end in .h
or .c.
Ranges of characters are supported:
zip archive "[a-f]*"
would add to the archive all files starting with "a" through "f".
Negation is also supported, where any character in that position
not in the list matches. Negation is supported by adding ! or ^
to the beginning of the list:
zip archive "*.[!o]"
matches files that don’t end in ".o".
On WIN32, [] matching needs to be turned on with the ‐RE option
to avoid the confusion that names with [ or ] have caused.
When these characters are encountered (without being escaped with a
backslash or quotes), the shell will look for files relative to the cur‐
rent path that match the pattern, and replace the argument with a list
of the names that matched.
The zip program can do the same matching on names that are in the zip
archive being modified or, in the case of the -x (exclude) or -i (in‐
clude) options, on the list of files to be operated on, by using back‐
slashes or quotes to tell the shell not to do the name expansion. In
general, when zip encounters a name in the list of files to do, it first
looks for the name in the file system. If it finds it, it then adds it
to the list of files to do. If it does not find it, it looks for the
name in the zip archive being modified (if it exists), using the pattern