1

I am trying to un-tar into a different directory using this

tar xvf BACKUP.tar -C test

But I am getting the following errors

File -C not present in the archive.
File test not present in the archive.

Using

tar xv -C test -f BACKUP.tar

I get the following error

tar: /dev/rmt0: A file or directory in the path name does not exist.

I do have a test directory and the file BACKUP.tar in the pwd that I am running the tar command in

Still the same error

tar -xvf BACKUP.tar -C test
File -C not present in the archive.
File test not present in the archive.

And

tar --version

gives this error

tar: Not a recognized flag: -
Usage: tar -{c|r|t|u|x} [ -BdDEFhilmopRUsvwZ ] [ -Number ] [ -f TarFil e ]
           [ -b Blocks ] [ -S [ Feet ] | [ Feet@Density ] | [ Blocksb ] ]
           [ -L InputList ] [-X ExcludeFile] [ -N Blocks ] [ -C Directory ] File ...
Usage: tar {c|r|t|u|x} [ bBdDEfFhilLXmNopRsSUvwZ[0-9] ] ]
           [ Blocks ] [ TarFile ] [ InputList ] [ ExcludeFile ]
           [ [ Feet ] | [ Feet@Density ] | [ Blocksb ] ] [-C Directory ] File ...
3
  • 1
    check tar with tar --version and your platform with uname -a Just put that info at the bottom of your post Commented Jun 4, 2015 at 14:27
  • Try typing absolute paths, maybe that helps Commented Jun 4, 2015 at 14:30
  • 1
    From the usage that tar spits out it looks like -C is supported. You still have not indicated what kind of system this is (or did I miss something?) Commented Jun 5, 2015 at 12:44

1 Answer 1

4

I suspect you're on AIX, where you're not allowed to mix old-style options without a minus (xvf) and new-style options with a minus (-C).

Put a minus in front of all your options, and it should work.

tar -xvf BACKUP.tar -C test

If that still doesn't work, also put each option separately, as per the help message

tar -x -v -f BACKUP.tar -C test

See also: https://unix.stackexchange.com/a/97360/3169

5
  • The post is tagged linux by the OP Commented Jun 4, 2015 at 14:39
  • 1
    "A file or directory in the path name does not exist." is an AIX error message. On Linux it would say "No such file or directory". And would default to stdin rather than /dev/rmt0. Commented Jun 4, 2015 at 14:41
  • I'll take your word for the AIX information. I can't remember, the last time I actually used AIX was around 1989. Commented Jun 4, 2015 at 14:46
  • 1
    @Anthon still the same error with the minus, is it possible for -C to just not be supported? Commented Jun 5, 2015 at 12:07
  • What about tar -x -v -f BACKUP.tar -C test? Commented Jun 5, 2015 at 14:37

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.