开发者

Untar contents to same directory [closed]

开发者 https://www.devze.com 2023-01-11 00:59 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消