Download and extract to a specific directory

Trying to download and extract a file to a specific folder, but getting an error. What am I doing wrong? Is there a way to rename the download if desired? Thank you :).

curl --url https://github.com/arq5x/bedtools2/releases/download/v2.26.0/bedtools-2.26.0.tar.gz | tar -xz --output /home/cmccabe/test
tar: unrecognized option '--output'
Try 'tar --help' or 'tar --usage' for more information.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   598    0   598    0     0   2939      0 --:--:-- --:--:-- --:--:--  2945
(23) Failed writing body

I would suggest that your version of tar does like it.

What OS are you running?

Robin

1 Like

My OS is ubuntu 14.04 . I can use tar with wget , but not with curl Thank you :).

You don't say what O/S you are working with?

What makes you believe that --output is a valid option for your tar on that O/S? Please post the man page section. I've not come across that switch.

I am familiar with:

tar -xz -C <output dir>

and

tar -xz -directory=<output dir>

It will depend on which O/S and what options are supported by your tar implementation.

If it doesn't work consider using 'gtar' and similar switches instead to extract the archive.

Hope that helps. If not, please post more info.

1 Like

man tar
The -C might be the switch you are looking for...

1 Like