简体   繁体   English

将某个文件从CPIO文件复制到另一个目录

[英]Copy a certain file from a CPIO file to a different directory

I am trying to copy a single file from a .cpio file, to a different directory rather than the tree inside it. 我试图将.cpio文件中的单个文件复制到不同的目录而不是其中的树。 I am trully sure it is possible, my teacher did it. 我很确定这是可能的,我的老师做到了。

I have tried this: 我试过这个:

# cpio -i -F backup.cpio sub1/sub2/example.php

But that doesn't extract the file example where I want it to be extracted. 但是,这并没有提取我希望它被提取的文件示例。 I tried adding a third parameter but it doesn't work. 我尝试添加第三个参数,但它不起作用。 Any suggestions? 有什么建议? Oh, and I'm running Ubuntu. 哦,我正在运行Ubuntu。

一种方法是将该单个文件解压缩到stdout并将其重定向到您选择的文件:

cpio -i --to-stdout sub1/sub2/example.php < backup.cpio > new_filename.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM