10

The name of the file 2014-12-12 04-00-01.tar. I executed the command:

tar xvf 2014-12-12\ 04-00-01.tar

The output is many lines of the form:

x ../server/: Path contains '..'

And then a few of the form:

tar: copyfile unpack (../server/logs/.DS_Store) failed: No such file or directory

It seems that I wasn't very careful when I wrote the backup script. How can I unpack the file?

14

You'll want to add the P (or -P) flag to your command line. From the manpage:

-P Preserve pathnames. By default, absolute pathnames (those that begin with a / character have the leading slash removed both when creating archives and extracting from them. Also, tar will refuse to extract archive entries whose pathnames contain .. or whose target directory would be altered by a symlink. This option suppresses these behaviors.

Try tar Pxvf 2014-12-12\ 04-00-01.tar. Note that you'll need write access to the parent directory of the working directory where you invoke the command.

1
  • That did the trick!
    – Thom Smith
    Dec 15 '14 at 5:33
0

You could try:
mkdir ./dir
tar xvf 2014-12-12\ 04-00-01.tar -C --./dir

4
  • tar: could not chdir to '--./dir'
    – Thom Smith
    Dec 15 '14 at 3:21
  • Strange. Try tar xvf 2014-12-12\ 04-00-01.tar -C --dir instead.
    – LDC3
    Dec 15 '14 at 4:11
  • What's the double-dash signify?
    – Xen2050
    Dec 15 '14 at 5:44
  • It's in the man file, I think it indicates that the letters that follow are part of the command since you can have tar xv -C --dir -f --2014-12-12\ 04-00-01.tar
    – LDC3
    Dec 16 '14 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.