How do you specify filenames within a zip when creating it on the command line from a pipe?

后端 未结 6 1844
面向向阳花
面向向阳花 2020-12-13 19:46

I\'m trying to create a zip file from file contents which are being piped in, e.g.

mysql [params and query] | zip -q output.zip -

This writ

6条回答
  •  萌比男神i
    2020-12-13 19:48

    I couldn't manage with the PHP answer (out of memory on bigger mysql dumps), and the FIFO was not working as I wanted, so my solution is to rename the file inside the ZIP archive after running the dump, using zipnote (which is included with the zip package on Debian).

    mysql [params and query] | zip -q output.zip -
    echo -e "@ -\n@=newname.sql" | zipnote -w output.zip
    

提交回复
热议问题