开发者

tar nests on a restoration

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜