0

Say I have a tarball ~/foo.tar containing

foo/
foo/bar.txt
foo/baz.txt
foo/qux/
foo/qux/corge.txt
foo/qux/grauply.txt

And in my home directory ~ I have an existing foo directory and the existing files

foo
├── bar.txt
├── elvis.txt
├── presley
│   └── graceland.txt
└── qux
    └── corge.txt

If I extract this tarball in ~, the following files will be overwritten:

~/foo/bar.txt
~/foo/qux/corge.txt

Is there a simple one-liner that will list those files for me?

1 Answer 1

1
for i in $(tar -tzf foo.tar);do ls -d ~/$i 2>/dev/null;done

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.