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?

David Moles
  • 444
  • 1
  • 4
  • 13

1 Answers1

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