tar {utils}R Documentation

Create a Tar Archive

Description

Create a tar archive.

Usage

tar(tarfile, files = NULL,
    compression = c("none", "gzip", "bzip2", "xz"),
    compression_level = 6, tar = Sys.getenv("tar"))

Arguments

tarfile The pathname of the tar file: tilde expansion (see path.expand) will be performed. Alternatively, a connection that can be used for binary writes.
files A character vector of filepaths to be archived: the default is to archive all files under the current directory.
compression logical or character. The type of compression to be used. Can be abbreviated.
compression_level integer: the level of compression. Only used for the internal method.
tar character string: the path to the command to be used.

Details

This is either a wrapper for a tar command or uses an internal implementation in R. The latter is used if tarfile is a connection or if the argument tar is "internal" or "".

Beware of portability considerations: the ‘tar’ format no longer has an agreed standard (‘Unix Standard Tar’ was part of POSIX 1003.1:1998 but has been removed in favour of pax), and in any case many common implementations diverged from the former standard. Known problems arise from

For portability, avoid file paths of more than 100 bytes, and links (or at least, hard links and symbolic links to directories).

The internal implementation writes only the blocks of 512 bytes required, unlike GNU tar which by default pads with nul to a multiple of 20 blocks (10KB). Implementations differ to whether the block padding should occur before or after compression (or both).

The internal implementation currently skips empty directories.

Value

The return code from system, invisibly.

See Also

http://en.wikipedia.org/wiki/Tar_(file_format), http://www.opengroup.org/onlinepubs/009695399/utilities/pax.html#tag_04_100_13_06 for the way the POSIX utility pax handles tar formats.

untar.


[Package utils version 2.11.0 Index]