如何从 stdin 构建 tar? [英] How can I build a tar from stdin?

查看:33
本文介绍了如何从 stdin 构建 tar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过管道将信息传送到 tar 并指定文件名?

How can I pipe information into tar specifying the names of the file?

推荐答案

类似:

tar cfz foo.tgz --files-from=-

但请记住,这不适用于所有可能的文件名;您应该考虑 --null 选项并从 find -print0 提供 tar.(xargs 示例不适用于大型文件列表,因为它会产生多个 tar 命令.)

But keep in mind that this won't work for all possible filenames; you should consider the --null option and feed tar from find -print0. (The xargs example won't quite work for large file lists because it will spawn multiple tar commands.)

这篇关于如何从 stdin 构建 tar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆