Zip File Structure- How to Compress & Uncompress a Zip File

  •   Written By
     
  • Published on
    March 29th, 2022
  • Updated on
    April 22, 2022
  • Read Time
    6 minutes
Summary:- Zipping a file and unzipping a file is a file management technique for packaging multiple files into a single small bundle. Zipping and unzipping are very popular for emailing file attachments, downloading, and FTP. Therefore, you must know how to compress & Uncompress a Zip File from the sharing point of view.

The Zip file itself is really just a container and it holds the real files inside it. The purpose behind the Zip file is transportation and storage and it acts like a Ziploc sandwich bag, i.e. it holds contents inside for easy transporting and storage. This makes Zip files (and their counterpart Rar files) very valuable to those users who share and download the files in a regular manner. But before you compress or uncompress a ZIP file, you must understand the structure of the ZIP FIle.

Structure of a ZIP File and How does it Work

You can see below, what a ZIP file looks like and it will give you a clear picture of the ZIP file structureCompressed and Uncompressed Zip

Meaning of Zip File in Simple Words

A ZIP file is identified by the presence of a central directory which is located at the end of the structure in order to allow the appending of new files. The central directory stores a list of the names of the entries (files or directories) stored in the ZIP file, along with other Metadata about the entry, and an offset into the ZIP file, pointing to the actual entry data. This allows a file listing of the archive to be performed relatively quickly, as the entire archive does not have to be read to see the list of files.

The entries in the ZIP file also include this information for redundancy. The order of the file entries in the directory need not coincide with the order of file entries in the archive. Each entry is introduced by a local header with information about the file such as the comment, file size, and file name, followed by optional “Extra” data fields, and then the possibly compressed, possibly encrypted file data. The “Extra” data fields are the key to the extensibility of the ZIP format. “Extra” fields are exploited to support the ZIP-64 format, WinZip-compatible AES encryption, file attributes, and higher-resolution NTFS or Unix file timestamps. Other extensions are possible via the “Extra” field. ZIP tools are required by the specification to ignore Extra fields they do not recognize.

Tools that correctly read ZIP archives must scan for the signatures of the various fields, in the ZIP central directory. They must NOT scan for entries because only the directory specifies where a file chunk starts. Scanning could lead to false positives, as the format allows for other data to be between chunks.

The ZIP specification also supports spreading archives across multiple system files. Originally intended for storage of large zip files across multiple 1.44 MB floppy disks this feature is now used for sending zip archives in parts over email, or over other transports or removable media.

How to Compress & Uncompress a Zip Files

Compressed files take up less storage space and can be transferred to other computers more quickly than uncompressed files. You can work with compressed files and folders in the same way that you work with uncompressed files and folders. You can also combine several files into a single compressed folder, making it easier to share a group of files, since you only need to attach one folder to an e‑mail message instead of several files.

Compress a Zip File or Folder

  1. Locate the file or folder that you want to compress.
  2. Right-click the file or folder, point to Send To, and then click Compressed (zipped) Folder.

This creates a compressed zip folder. To rename it, right-click the folder, click Rename, and then type the new name.

Uncompress a Zip File or Folder

  1. Locate the compressed folder that you want to extract files or folders from.
  2. Do one of the following:
  • To extract a single file or folder, double-click the compressed folder to open it. Then, drag the file or folder from the compressed folder to a new location.
  • To extract the entire contents of the compressed folder, right-click the folder, click Extract All, and then follow the instructions.

Advantages of ZIP Files

  • You save storage space. Zipping large files can save up to 80 percent or more in hard disk space.
  • A smaller file size drastically reduces e-mail transmission time.
  • The smaller file size of e-mail messages that you want to keep is useful when your mailbox has a space limit.
  • Many zip utilities allow you to encrypt files and protect sensitive data, especially when you send it in an e-mail.
  • You can send and receive e-mail attachments, such as .exe files.
  • Many zip utilities support disk spanning, which means when you create a .zip file on a removable disk and run out of disk space, the utility prompts you to insert additional disks as needed and then continues the process.
  • Many zip utilities allow you to create a self-extracting archive. These are archives that compress and package the files that you specify as an executable (.exe) file. When you click the executable file to open it, the .exe has the ability to extract the files from within itself and produce the original files.

Limitations of ZIP Files

  • The minimum size of a ZIP file is 22 bytes.
  • The maximum size for both the archive file and the individual files inside it is 4,294,967,295 bytes (232−1 bytes)for standard ZIP and 18,446,744,073,709,551,615 bytes (264−1 bytes) for ZIP6
  • This approach is less well-suited, in general, to archival a large number of small files. In the ZIP archive format, the metadata for each entry—the information about each individual entry—is not compressed. This limits the maximum achievable compression ratio, especially as the size of the individual entries diminishes and approaches the size of the metadata for the entry

Conclusion

Sometimes a zip file gets corrupted and prompts the error message, “The Compressed (zipped) folder is invalid or corrupted” while opening the zip file. In this case, you can try to repair the corrupt zip file manually by using the WinRAR tool. WinRAR has a built-in repair feature that helps users repair corrupt RAR as well as zip files. You can even Fix Invalid and Corrupt Zip Files for Free. On the other hand, if you are unable to fix the ZIP file corruption issue manually, then you can use the Sysinfo ZIP File Repair Tool. Now you know how to compress and uncompress a ZIP file but any type of error during zipping or unzipping denotes that your ZIP file is corrupted. Therefore, the solutions given above will resolve the error related to the ZIP file.

Related Post