updateArchive {Rcompression}R Documentation

Add the contents to a zip file.

Description

This function allows the caller to update the contents of a Zip archive, adding or overwriting existing entries within an archive, leaving others umodified.

It is often more convenient to use the [<- operator to add/update elements of an archive, e.g. archive[ c("a", "b") ] = list(I("Some text"), "myFile")

updateArchiveFiles is a higher-level function that knows about XML files and is used for Office Open file format. This function will most likely be moved to a different package in the future, e.g. ROOXML.

updateArchive currently works for zip files only, but it can be made generic and methods can be easily added for different types of archives (e.g. tar files) assuming the underlying functionality to add the files is available.

Why do we have dir and fileNames? The reason is that the file names identify the elements within the archive and so must be given without any prefix path. dir serves as this prefix path.

Usage

updateArchive(archive, fileNames, dir, verbose = FALSE,
              zip = getOption("zip", "zip"))
updateArchiveFiles(archive, doc, ..., .files = list(...),
                    zip = "zip -q",  dir = tempfile())

Arguments

archive the ZipArchive object.
fileNames the names of the files to be added the archive. When this function is called, these should be files in the file system, located under dir. Other, higher-level functions can work with the contents directly rather than files.
dir The directory in which to find the specified files.
verbose a logical value indicating whether to emit information about the steps being performed.
zip a string identifying how to invoke the zip shell command
... any additional, supporting files such as images, style files, etc. which are updated in the rels/ component of the document
.files an alternative to ... which is useful when one already has the additional files in a list.
doc the document to be added, typically the central document of an Office Open file. The .files/... are the supporting/related files such as images, styles, etc.

Author(s)

Duncan Temple Lang

References

The zip command-line utility.

See Also

zipArchive


[Package Rcompression version 0.8-0 Index]