Description Usage Arguments Value Note Author(s) See Also Examples
Note that the directory name itself will not be included in the directory. The path to all files will be relative to the specified directory.
1 |
dir |
the parent directory, whose files are to be zipped. |
zip.file |
the zip file to be created |
exclude.patterns |
an optional vector of patterns to be excluded. eg "\*.zip" NB: use \* to allow zip to do the pattern exclusion rather than shell |
verbose |
logical: print the zip command. Default=FALSE |
a zip file is created, containing all files within dir
This uses system commands, and needs to be able to find the gnu zip
program. You can specify the zip program using options("zip") <-
"/path/to/zip"
. If this is not specified, then we assume that the shell
can find a program called zip
on the path. On ubuntu and OSX this
is ‘/usr/bin/zip’.
Mark Cowley, 2010-04-14
1 2 3 4 5 6 7 8 | dir <- tempdir()
writeLines(letters, file.path(dir, "a.txt"))
writeLines(LETTERS, file.path(dir, "b.txt"))
zipdir(dir, file.path(dir, "tmp.zip"), verbose=TRUE)
cmd <- paste("unzip -l", file.path(dir, "tmp.zip"), collapse=" ")
system(cmd)
f <- c(file.path(dir, "a.txt"), file.path(dir, "b.txt"), file.path(dir, "tmp.zip"))
unlink(f)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.