The Background: I have a python script that generates a bunch of images (png format, minimum of several hundred), runs ffmpeg to turn them into a short video, and then puts all of the images into a zip archive so I can go back if I find any strange or interesting things where I want the individual frame.

The Issue: Originally the zip portion read as zip -q -T -m output *.png but that suppressed all the output, including the statement as to whether the file is ok. Is there a way to suppress the large number of updating: Stars0053.png (deflated 5%) without suppressing the output of the -T switch?

  • does adding this behind it work: |grep updating >/dev/null ?
    – Rinzwind
    Jun 17 '11 at 14:08
  • For some reason that's suppressing the -T output line as well. Is the >/dev/null maybe applying to the output of both zip and grep?
    – thegrinner
    Jun 17 '11 at 14:18
  • Maybe the zipfile module from Python's standard lib can do what you want (it has a testzip() method). Jun 17 '11 at 15:11
  • I'm doing that now and that works fine. If you want to post it as an answer I can accept it.
    – thegrinner
    Jun 17 '11 at 15:47
zip -q -T -m output *.png  && echo "success" || echo "failure"

should work too, alternative to the solution, given in the comments.

It works like this: If the first commmand (zip ...) succeeds, the following combination with && can succeed too and is performed. But if the first part fails, then the whole combination will fail, and the &&-part is skipped, but an or-combination is successfull if one of both is successful, so the ||-part is performed.

You aren't interested in the combined result (true/false), but in the side-effect: a status feedback.

  • Wow, that's pretty much exactly what I was looking for. Thanks!
    – thegrinner
    Jun 17 '11 at 17:00
  • -q --quiet Quiet mode; eliminate informational messages and comment prompts. (Use‐ ful, for example, in shell scripts and background tasks).
    – Íhor Mé
    Feb 22 '20 at 14:17

Alternatively you can use pythons own zip library:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.