sevenzip_listcont: List 7-zip file contents

View source: R/sevenzip_listcont.R

sevenzip_listcontR Documentation

List 7-zip file contents

Description

List the contents of one or more valid file 7-zip extensions in a directory

Usage

sevenzip_listcont(archive_path, extras = NULL, recursive = FALSE, parse = TRUE)

Arguments

archive_path

A path containing valid file extensions. See details for allowed extensions.

extras

Additional arguments to pass to sevenzip_makecmd

recursive

Should the call to list.files be performed recursively? Defaults to FALSE

parse

Parse the raw return via sevenzip_parseinfo? Defaults to TRUE

Details

Valid file extensions include 7z, zip, rar, gzip, rar, gzip, tar, bzip2, gz, tar.gz, tgz, bz, wim. File (directory) listing is performed with a (non-recursive by default) call to list.files. An error is raised if no files including one of these extensions are found in archive_path.

Running this with recursive=TRUE can be a useful way to get a listing of the contents of all valid archive files in a directory. Note, though, that this can take some time, depending on the scope and/or level of nesting of the target directory.

Value

By default, a list of length 2:

  • success A list; if no valid archive contents could be accessed, then an empty list of length 1, otherwise, of length 2:

    • is_parseable: A data.frame of successfully parsed items, unless no items were parseable, in which case an empty list, i.e. list()

    • not_parseable: A list of unparseable items, containing the raw text output; if none, then an empty list, i.e. list()

  • failure A list of archives where 7-zip could not access any files within.

If parse=FALSE, then a list of raw output

Note

There is no guarantee that this will work for a non-Windows OS.

recursive refers to the files in a directory, and not the contents of each archive. In other words, this function will not look beyond the first listing level in an archive.

See Also

Other sevenzip functions: sevenzip_checkpath(), sevenzip_makecmd(), sevenzip_parseinfo()

Examples

# TBD

slin30/wzMisc documentation built on Jan. 27, 2023, 1 a.m.