Skip to content

more file ops stuff #29

@franknarf1

Description

@franknarf1

Eg, to read tar.gz

fread_targz = function(fp, zp = "C:/Program Files/7-Zip/7z"){
  # only tested on windows
  # fp should be the path to mycsv.tar.gz
  # zp should be the path to 7z.exe
  # thanks to Joachim Sauer: https://superuser.com/a/1283392/

  qzp = shQuote(zp)
  qfp = shQuote(fp)

  patt = "%s x -so %%s | %1$s x -si -so -ttar"

  thecall = patt %>% sprintf(qzp) %>% sprintf(qfp)
  cat("The call:", thecall, sep="\n")

  fread(thecall)
}

fread_targz("C:/Users/ferickson/Downloads/mycsv.tar.gz")

Fits ahead of "Tables > Input and output > Reading and writing other formats".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions