Skip to content
Advertisement

how to use untar() in R linux?

I’m getting this error when I use untar()

command used: untar(tarfile = "a.rar", list = TRUE)

/bin/tar: Este não parece ser um arquivo-tar
/bin/tar: Pulando para o próximo cabeçalho
/bin/tar: Saindo com status de falha em razão de erros anteriores
character(0)
attr(,"status")
[1] 2
attr(,"errmsg")
[1] "Arquivo ou diretório inexistente"
Warning message:
In system(cmd, intern = TRUE) :
  execução do comando '/bin/tar -tf 'a.rar'' teve status 2

It works when I use on my PC (Windows 10) but does not works on another PC (Linux 20.04)

Thanks

Advertisement

Answer

This isn’t correct:

untar(tarfile = "a.rar", ...)

You should specify a tape archive file such as "a.tar", rather than a RAR-format file.

The underlying utility on Windows is being (too?) forgiving, and accepting other archive formats that it knows how to deal with, like RAR. But the public API for the untar() function makes no such promises, so avoid doing that.

Consider calling an external conversion utility beforehand, so a proper tar file will always be available at that point, even if you began with a *.rar file.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement