tar 排除标签
我有以下文件夹结构: myFolder
和 testFolder
其下有相同的文件夹,我只想从 testFolder
中排除 my1
code> 而不是 myFolder
。
myFolder
+---my1
+---my2
+---my3
testFolder
+---my1
+---my2
+---my3
我尝试在创建 tar 文件时使用排除标签以及包含的文件夹。 这就是我所拥有的,但它似乎不起作用。
tar -cvf base.tar "/sam/myFolder" "/sam/testFolder" --exclude="/sam/testFolder/my1"
I have the following folder structure: myFolder
and testFolder
have same folders underneath it and I want to exclude only my1
from testFolder
and not myFolder
.
myFolder
+---my1
+---my2
+---my3
testFolder
+---my1
+---my2
+---my3
I am trying to use exclude tag along with included folders while creating a tar file.
This is what i have, but it does not seem to work.
tar -cvf base.tar "/sam/myFolder" "/sam/testFolder" --exclude="/sam/testFolder/my1"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是 Perl 技术人员。这是我经过一番研究后发现的。
命令是正确的。唯一的问题是路径。我们需要小心相对路径。
文件夹结构:D:\tools\Packet\sam\
D:\tools\Packet>tar -pcvf base.tar "sam/myFolder" "sam/testFolder" --exclude "sam/testFolder/my1"
-cvf
-pcvf
两者都工作正常。
I am not a techie in perl. This is what i found after a bit of research.
The command was correct. The only problem was with the paths. we need to be careful with the relative paths.
folder structure: D:\tools\Packet\sam\
D:\tools\Packet>tar -pcvf base.tar "sam/myFolder" "sam/testFolder" --exclude "sam/testFolder/my1"
-cvf
-pcvf
both work fine.