When I run gunzip -dc /path_to_tar.gz_file/zip1.tar.gz | tar xf -
in the directory where the tar.gz
file is located, it extracts just fine.
How do I tell it to place the contents from the tar.gz
file into a specific directory?
I tried this gunzip -dc /path_to_tar.gz_file/zip1.tar.gz | tar xf /target_directory
with a tar
error.
I should also note here that I am attempting to do this in a bash script and that I'm running Solaris 10.
Best Answer
You can do a single
tar
command to extract the contents where you want:As explained in the
tar
manpages:As you added that you are using Solaris, I think you could try: