On Tuesday, November 1, 2016 2:56:23 AM CET [email protected] wrote:
> Hello.
> I don't know if it is a bug or something like that.
> What flag should I use if I want to overwrite existing non-empty directory by
> symlink from my tar archive?

There's --recursive-unlink.  But I would be careful to explicitly select
proper set of files to be extracted, rather then extract the whole archive
(there's high chance this will cause some disaster).

Documentation: info tar -n "Recursive Unlink"

Pavel

> I've tried --overwrite flag and -U, that did not
> work. Tried with tar version 1.29 and 1.28.  Here is example:
>  
> ➜  ln -s /dev/null test
> ➜  tar -cf archive.tar test
> ➜  rm -f test
> ➜  mkdir -p test/something
> ➜  tar --overwrite -xf archive.tar  
> tar: test: Cannot open: File exists
> tar: Exiting with failure status due to previous errors
> ➜  tar -U -xf archive.tar 
> tar: test: Cannot unlink: Directory not empty
> tar: Exiting with failure status due to previous errors
> ➜  rmdir test/something 
> ➜  tar --overwrite -xf archive.tar
> ➜  echo $?
> 0



Reply via email to