tar xf foo -- how to restore symlink?

Gary Aitken freebsd at dreamchaser.org
Wed Apr 18 04:21:06 UTC 2018

I've got a tarball with an archived symlink and its contents.
The symlink points to another directory in the tarball, and the
tarball contains copies of the files in the symlinked directory.

A normal extract fails with the message:
$ tar -xf nufraw-0.41.tar.gz
nufraw-0.41/doc-pak: Can't replace existing directory with non-directory

What's the right way to deal with this?

How do I get tar to restore the symlink as a symlink?
   -k and --exclude allow tar to continue unpacking,
   but don't restore the symlink as such.

"man tar" doesn't seem to have what I want but I'm probably blind.



More information about the freebsd-questions mailing list