1% File src/library/utils/man/zip.Rd
2% Part of the R package, https://www.R-project.org
3% Copyright 1995-2020 R Core Team
4% Distributed under GPL 2 or later
5
6\name{zip}
7\alias{zip}
8\title{Create Zip Archives}
9\description{
10  A wrapper for an external \command{zip} command to create zip archives.
11}
12\usage{
13zip(zipfile, files, flags = "-r9X", extras = "",
14    zip = Sys.getenv("R_ZIPCMD", "zip"))
15}
16\arguments{
17  \item{zipfile}{The pathname of the zip file: tilde expansion (see
18    \code{\link{path.expand}}) will be performed.}
19  \item{files}{A character vector of recorded filepaths to be included.}
20  \item{flags}{A character string of flags to be passed to the command:
21    see \sQuote{Details}.}
22  \item{extras}{An optional character vector: see \sQuote{Details}.}
23  \item{zip}{A character string specifying the external command to be used.}
24}
25\details{
26  On a Unix-alike, the default for \code{zip} will use the
27  value of \env{R_ZIPCMD}, whose default is set in \file{etc/Renviron}
28  to the \code{zip} command found during configuration.  On Windows, the
29  default relies on a \command{zip} program (for example that from
30  Rtools) being in the path.
31
32  The default for \code{flags} is that appropriate for zipping up a
33  directory tree in a portable way: see the system-specific help for the
34  \command{zip} command for other possibilities.
35
36  Argument \code{extras} can be used to specify \code{-x} or \code{-i}
37  followed by a list of filepaths to exclude or include. Since
38  \code{extras} will be treated as if passed to \code{\link{system}}, if
39  the filepaths contain spaces they must be quoted e.g. by
40  \code{\link{shQuote}}.
41}
42\value{
43  The status value returned by the external command, invisibly.
44}
45\seealso{
46  \code{\link{unzip}}, \code{\link{unz}}; further, \code{\link{tar}} and
47  \code{\link{untar}} for (un)packing tar archives.
48}
49
50\keyword{file}
51\keyword{utilities}
52
53