File Compression Notes

Fixing a corrupted zip file

If you try to open a zip file and it won’t unzip you can often fix it by rezipping the file (source).

First, try:

zip -F --out

If that doesn’t work try:

zip -FF --out

If you receive an error message like:

zip error: Entry too big to split, read, or write (Poor compression resulted in unexpectedly large entry - try -fz)


  1. Make sure you have at least version 3.0 of zip
  2. Try adding -fz to the command
zip -FF -fz --out

Increasing compression

There is a tradeoff between how long it takes to compress something and how much smaller gets. When using zip this is controlled by a numeric argument ranging from 1 (faster) to 9 (smaller). So, if you’re archiving large objects try using zip -9.

If you have a bunch of already zipped files you can recompress them using the following bash loop:

for f in *.zip
  mkdir ${f%.*}
  unzip -d ${} $f
  rm $f
  rm ${f%.*}/${f%.*}.csv
  zip -r -9 $f ${}