Skip to content
Search

Zip

lastmod 2026-04-03created 2015-02-2512 edits

Command to package and compress (archive) files.

How to use

$ zip <flags> <output> <list_of_files>

Flags

  • -r: compress including subdirectories.
  • -F: zip compression including files with Korean names.
  • -e: set a password.

Create a Zip File

To create a zip file, enter:

$ zip filename.zip input1.txt input2.txt resume.doc pic1.jpg

To include the contents of a directory in a zip archive, enter:

$ zip -r backup.zip /data

Recovering a broken Zip file

On Linux, you can try the -FF option of the zip command.

zip -FF 손상된파일.zip --out 복구된파일.zip

The key part is generally the end:

Central Directory found...
Zip64 EOCDR found ( 1 12679424190)...
Zip64 EOCDL found ( 1 12679424246)...
EOCDR found ( 1 12679424266)...

Cause analysis: this ZIP is about ~12.7GB (12,679,424,266 bytes), exceeding the standard ZIP 4GB limit, so it uses the Zip64 extended format. The problem was most likely one of the following:

  • Zip64 Central Directory corruption/mismatch — the archive uses a Zip64 EOCDR (End of Central Directory Record), and the offset or size information in this record may not have matched the actual data. This commonly happens when some bytes are lost/altered while downloading from Zenodo.
  • Incomplete download — since it is a 12.7GB file, a network interruption may have truncated the end of the file, or the Central Directory may not have been written correctly.
  • Zip64 compatibility issue — differences in Zip64 implementation between the tool that created the archive and the tool reading it.

What zip -FF did was rebuild the archive by scanning the "Local File Header (PK\x03\x04)" entries in the file one by one, without relying on the "Central Directory". All entries were processed normally with copying: and there were no error messages, so "recovered.zip" should be usable normally.

To be sure, verify its integrity with unzip -t recovered.zip.

See also

Favorite site

author Zer0 sitemap