0

I am having trouble quietly zipping a large zip file which needs fixing.

I have a large zip file that needs fixing so I can use -FF flag:

zip -FF TEST.zip --out TEST_fixed.zip

If I want to suppress the print statements I can add the -q flag

zip -q -FF TEST.zip --out TEST_fixed_quiet.zip

But the resulting file is empty:

$ unzip -q TEST_fixed_quiet.zip
warning [TEST_fixed_quiet.zip]:  zipfile is empty

This is not the expected behavior for the -FF flag. Zipping TEST.zip with -FF and without -q yields the correct non-empty archive. Zipping TEST.zip with -F and -q yields the correct non-empty archive.

So how can I zip a file quietly with the -FF flag and without destroying it in the process?

0

1 Answer 1

1

Using -FF together with -q seems to destroy the zip file.

$ ll
total 8
-rw-r--r--  1 pse  staff  1151 Feb 12 16:26 foo.txt
$ zip foo foo.txt
  adding: foo.txt (deflated 44%)
$ zip -q -FF foo.zip --out foo-fixed.zip
$ ll
total 24
-rw-------  1 pse  staff    22 Feb 23 20:19 foo-fixed.zip
-rw-r--r--  1 pse  staff  1151 Feb 12 16:26 foo.txt
-rw-r--r--  1 pse  staff   806 Feb 23 20:18 foo.zip
$ unzip -l foo-fixed.zip 
Archive:  foo-fixed.zip
warning [foo-fixed.zip]:  zipfile is empty

But you can suppress the default output by redirecting it:

$ zip  -FF foo.zip --out foo-fixed.zip > /dev/null
$ ll
total 24
-rw-------  1 pse  staff   806 Feb 23 20:40 foo-fixed.zip
-rw-r--r--  1 pse  staff  1151 Feb 12 16:26 foo.txt
-rw-r--r--  1 pse  staff   806 Feb 23 20:18 foo.zip
3
  • Yes, this is the issue I'm running into and was trying to convey. This is not the correct behavior for the -FF flag. Zipping TEST.zip with -FF and without -q yields the correct non-empty archive.
    – mqjg
    Feb 23, 2023 at 19:36
  • 1
    @mqjg That was definitively not obvious from reading your question. But nevermind, I added a solution to my answer.
    – nohillside
    Feb 23, 2023 at 19:42
  • Piping the output is a good suggestion!
    – mqjg
    Feb 23, 2023 at 19:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .