tags:

views:

19

answers:

1

I have this scenario in UNIX:

I am tar'ing files of a directory like this:

tar cvf test.tar /dir1/dir2/file1.xml /dir1/dir2/file2.xml

When I copy this tar file to a different directory and Untar it, I want the two files(and all the other files) to be untared in the curent directory only. How can I do this? Btw, I must be using the absolute path only, for creating the tar.

+1  A: 

Since you use the same /dir1/dir2 in both files, you could also use tar’s -C parameter to specify the directory.

tar c -C /dir1/dir2 -vf test.tar file1.xml file2.xml

Then, there would be no subdirectories in your tar file.

Scytale