[SunHELP] extract tar file in the current directory?

Andreas Putzo andreas.putzo at araldirekt.de
Wed Nov 24 02:42:50 CST 2004


Hi,

On Wednesday 24 November 2004 07:32, ert weerr wrote:

> I have a tar file what I want to extract in a
> temporary directory.
> The problem is that the tarball has been created
> by using the full-paths...

> If I'd extract it in /tmp than it still overwrote
> the original files in /opt/package...

> Can I force tar to extract the files in the /tmp
> directory?

Unless you specify -P tar should remove the leading slashes,
e.g.: 
$ pwd
/tmp/tmp
$ tar tvf mytest.tar
drwxr-xr-x andreas/andreas   0 2004-11-24 09:32:07 /tmp/test/
-rw-r--r-- andreas/andreas   0 2004-11-24 09:32:07 /tmp/test/bla
$ tar xvf mytest.tar
tar: Removing leading `/' from member names
/tmp/test/
/tmp/test/bla
$ ls -l
-rw-r--r--  1 andreas andreas 10240 2004-11-24 09:33 mytest.tar
drwxr-xr-x  3 andreas andreas  1024 2004-11-24 09:36 tmp

Also, the update flag (-U) might be an option for you.


regards, Andreas



More information about the SunHELP mailing list