zip
Create, Extract, or List zip Archives

Description

Creates, extracts, or lists zip archives through the system command zip and unzip.

Usage

zip(zipfile, files, flags = "-r9X", extras = "",
    zip = Sys.getenv("R_ZIPCMD", "zip"))
unzip(zipfile, files = NULL, list = FALSE, overwrite = TRUE, 
    junkpaths = FALSE, exdir = ".", unzip = Sys.getenv("TERR_UNZIPCMD", unset = "unzip"),
    setTimes = FALSE)

Arguments

zipfile a character vector specifying one or more file paths of zipped files.
files a character vector specifying one or more file paths.
flags a character string with prefix "-" specifying the flags for zip. By default, "-r9X" specifies recursing into directories, providing better compression and excluding additional file attributes. for more detail, see the help file for the system "zip" command.
extras a character vector. Includes the extra arguments to pass to the zip command.
zip a character string specifying the command used to compress the file or directory.
list a logical value. If TRUE, lists all files in an unziped archive, not extracting files.
overwrite a logical value.
  • If TRUE, overwrites the existing files without prompting.
  • If FALSE, does not overwrite existing files and displays a warning message.
junkpaths a logical value. If TRUE, junks the directory names. (That is, it puts all non-directory files directly into the directory exdir and makes no new directories.)
exdir a character string specifying the directory where the files are extracted. The length of the character string cannot be longer than 254 characters.
unzip a single character string specifying the system command to use to unzip the file or directory.
setTimes a logical value. If TRUE, displays the time information of the unzipped files.

Details

The following conditions result in an error. Files are extracted in quiet mode, overwriting existing files without prompting.
zip and unzip always use an external executable to zip and upzip files. The special value of "internal" for the zip and unzip arguments are ignored.
Value
returns the value of the function system2. If list = TRUE, the unzipped file information is displayed.
See Also
system2, memCompress, shQuote.
Examples
## Not run: 
zip("./copyzip", file.path(R.home("doc"), "COPYING"))
unzip("./copyzip.zip", unzip = "unzip", list = TRUE)
unzip("./copyzip.zip", exdir = "D:/test_zip", unzip = "unzip")

## End(Not run)
Package utils version 6.1.4-13
Package Index