| unzip {zip} | R Documentation |
unzip() always restores modification times of the extracted files and
directories.
unzip(zipfile, files = NULL, overwrite = TRUE, junkpaths = FALSE, exdir = ".")
zipfile |
Path to the zip file to uncompress. |
files |
Character vector of files to extract from the archive.
Files within directories can be specified, but they must use a forward
slash as path separator, as this is what zip files use internally.
If |
overwrite |
Whether to overwrite existing files. If |
junkpaths |
Whether to ignore all directory paths when creating
files. If |
exdir |
Directory to uncompress the archive to. If it does not exist, it will be created. |
If the zip archive stores permissions and was created on Unix, the permissions will be restored.
## Some files to zip up
dir.create(tmp <- tempfile())
cat("first file", file = file.path(tmp, "file1"))
cat("second file", file = file.path(tmp, "file2"))
zipfile <- tempfile(fileext = ".zip")
zipr(zipfile, tmp)
## List contents
zip_list(zipfile)
## Extract
tmp2 <- tempfile()
unzip(zipfile, exdir = tmp2)