Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
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). –  Florian Diesch 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

2 Answers 2

up vote 1 down vote accepted
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.

share|improve this answer
    
Wow, that's pretty much exactly what I was looking for. Thanks! –  thegrinner Jun 17 '11 at 17:00

Alternatively you can use pythons own zip library:

http://docs.python.org/library/zipfile.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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