Cannot set target directory when extracting an archive using tar
Posted
by
palto
on Server Fault
See other posts from Server Fault
or by palto
Published on 2012-08-02T13:53:14Z
Indexed on
2012/09/01
15:39 UTC
Read the original article
Hit count: 308
I'm trying to extract a tar archive to a specific directory. I've tried using -C flag but it doesn't work as expected. Here is the commandline I'm using
tar xvf myarchive.tar -C mydirectory/
This gives me a following error:
tar: file -C: not present in archive
tar: file mydirectory/: not present in archive
I've also tried setting the -C flag before the archive file but it just says this:
tar xvf -C mydirectory/ myarchive.tar
tar: -C: No such file or directory
What am I doing wrong?
EDIT: tar -tf shows that the tar archive does not have full path names:
tar -tf myarchive.tar
herareport/
herareport/bin/
...
© Server Fault or respective owner