Untar contents to same directory [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question 开发者_开发技巧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.
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.
精彩评论