Rafael
Rafael

Reputation: 3196

fread zipped file with 7z

I want to read in a file with fread in R. I have 7z installed.

I tried

fread(shell(cmd = '7z l test.txt.gz'), shell = 'cmd.exe'))

However I get the error

Error in fread(shell(cmd = paste0("7z x ", "\"", dest, "\""), shell = "cmd.exe")) : 
  'input' must be a single character string containing a file name, a command, full path to a file, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or the input data itself

I'm looking for something similar to:

 fread(shell(cmd = 'unzip -cq test.zip', shell = 'cmd.exe'))

Upvotes: 1

Views: 1840

Answers (1)

Xing Zhang
Xing Zhang

Reputation: 175

One work-around is to copy 7z.exe to the project folder. And try:

DT = fread(cmd = '7z e -so "test.zip"')

Some people suggested adding 7-zip to Windows PATH Environment Variable. But it did not work for me.

Upvotes: 1

Related Questions