How can I build a tar from stdin?

后端 未结 6 909
攒了一身酷
攒了一身酷 2020-12-04 16:20

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

6条回答
  •  一整个雨季
    2020-12-04 16:47

    Something like:

    tar cfz foo.tgz -T -
    

    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.)

提交回复
热议问题