开发者

Linux: Adding named files to a zip archive, from a pipe

Is it possible to use something like:

command.exe | zip >> archive.zip

开发者_如何学JAVA

command2.exe | zip >> archive.zip

...and end up with two named files inside one zip archive. This way, if at all possible, would be neater than having temp files.


Create two named pipes in a new dir (with mkfifo), pipe the output of the commands to these two pipes and then zip the dir.

mkdir tmp
mkfifo tmp/1.out
mkfifo tmp/2.out
command1.exe > tmp/1.out
command2.exe > tmp/2.out
zip -FI -r tmp.zip tmp/

EDIT: Added the FI flag to zip, which does make this possible. The only caveat is that you need zip 3.0 for this to work. Tar:ing FIFO:s is not implemented (according to tar devs) because you need the file size in advance in order to write it to the TAR header.


Use fuse, fuze-zip rather.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜