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/ ...