开发者

tar nests on a restoration

开发者 https://www.devze.com 2023-01-30 06:12 出处:网络
Is the following a known and long-standing inconsistency/feature of tar?I suspect the answer is yes. cd mydir

Is the following a known and long-standing inconsistency/feature of tar? I suspect the answer is yes.

cd mydir
tar cvpf dec14.tar .
tar xvpf dec14.tar -C .

Files are extracted to where they are supposed to be.

cd ..
tar cvpf dec14.tar mydir
tar xvpf dec14.tar -C mydir

Files are restored nested in mydir/mydir, in ot开发者_JAVA百科her words, nested one level lower than before.


No, it's not an inconsistency or bug. 'tar' is doing exactly what you told it to do. The '-C' option just means to change into the given directory first, it doesn't imply anything about trimming that string off the extracted paths.

0

精彩评论

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