ZIP file

From DPWiki
Jump to navigation Jump to search

A ZIP file (also ZIP archive, file extension .zip) contains one or more files that have either been stored intact or been compressed to reduce file size, using the ZIP file format. Wikipedia's article has more detailed information about the ZIP file format and ZIP files.


CAUTION: The instructions provided below may not work for the version of the operating system being used. If additional help is needed, please post a message to this forum thread.

Creating a ZIP file

Creating a ZIP file (also zipping a file) creates one file that may contain multiple files.

  • Many volunteers at Distributed Proofreaders create "nested ZIP files" to submit a document or project. A nested ZIP file is created by first creating ZIP files of smaller portions of a project, then creating a "master" ZIP file that contains the smaller ZIP files. This method allows the "master" ZIP file to be opened while still leaving the ZIP files within the "master" ZIP file intact.
    • EXAMPLE: A project consists of text pages, illustrations, and a readme file. First, create separate ZIP files for the text pages (TEXT.zip) and the illustrations (ILLUS.zip). Then, create a "master" ZIP file (MASTER.zip) including the TEXT.zip and ILLUS.zip files and the readme file.

Below are instructions to create ZIP files, based on the operating system or program being used.

Windows

To create a ZIP file using Windows:

  1. Right-click on an empty area of the desktop.
  2. Select "New" from the menu, then "Compressed (zipped) file. A new icon appears on the desktop.
  3. Re-name the icon with the selected ZIP file name.
  4. Right-click on the icon.
  5. Select ""Properties" from the menu. Under the "General" tab, make certain that the "Type of File" is listed as "Compressed (zipped) folder (.zip)".
CAUTION: There have been reports that this function may not be reliable when including more than 50 files in the .zip file.

Mac OS X

Why do we bother?

Sometimes we have to create zip archives that need to be easy to use on computers other than Macs, most notably Windows machines. This will be the case most commonly in content providing, post-processing, uploading to the Smooth Reading pool, uploading for PPV, or uploading directly (DU) to PG.

When zipping files using the Finder “Compress” (formerly “Create Archive of…”) contextual menu item, the resulting zip file contains special Mac files that tell the operating system how to display files and folders. Those files are not usually displayed on a Mac, but they are on other operating systems and so will bother or confuse other people. (Even on a Mac, they are not useful in zip archives.)

Before uploading anything to PGDP or Project Gutenberg, we need to get rid of those special files.

This page presents some utilities that make creating “clean” zip files (i.e. ones that do not contain Mac-specific content) on the Mac more comfortable than manually removing files in a Terminal window before creating the archive. If you like using the command line and feel no need for help creating zip archives, OR would rather not install additional programs, you do not need this Wiki page.

There are many ways to either create a zip without the invisible files, or clean the invisible files out of an existing zip, Some free, some not.

The links provided below are still active as of this writing, but have not all been verified to still be free. The list is not meant to be exhaustive, and is likely to be outdated. The current version of this page was updated by srjfoo 17:06, 13 October 2019 (EDT)

Useful Tools

Junecloud Automator Actions

What you will get

Junecloud Automator Actions are a collection of actions to use in the Automator.

An Automator Action is a group of commands packaged together that are run much as we would run any program. Most of the Junecloud actions are targeted at a web designer/developer audience. The one we are looking into here is called “Create Clean Archive”.

This allows the user to select files in Finder, and use the contextual menu to create the zip.

Keka

What you will get

You can get Keka either directly from the linked website, or from the Apple App store. The App store is not free, the version from the website is.

How to use

Before you use it for the first time, open the application, and go to Preferences under the Keka menu. Click on the Compression tab, and check the checkbox beside “Exclude Mac OS X resource forks (ex: .DS_Store)”. Default format should be set to “Zip”. Another convenient preference to set: under Name and location in the Compression tab, set Save to location: to “Ask each time”. This wll allow you to both give your zip a name other than the default name, and to determine the location where the zip will be stored.

To use, you can either add a dock icon and drag and drop the files you want zipped onto the icon in the dock, or drag and drop them onto the icon in the Applications directory.

YemuZip

What you will get

You can get YemuZip either directly from the linked website, or from the Apple App store. The App store is not free, the version from the website is. The free version displays ads.

How to use

Drag files onto the YemuZip application window in order to zip them; it gives you the choice between “Mac” and “PC” for each archive. To omit the Mac-specific files, choose “PC”. You also are given the choice of where to save the zip.

ZipCleaner 1.0

What you will get

The download includes both the application, and a short readme. Once you download it and unzip it, move the folder to wherever you want to keep it.

How to use

Create your zip using the built-in system zip utility. Drag the zip to the ZipCleaner window, and drop it. It will clean the Mac-specific invisible files out of the zip.

Linux and other Unix-based systems

To create a ZIP file using Linux and other Unix-based systems (including OS X): From the command line, type zip followed by the name of the ZIP file to be created, followed by the names of the files to be included in the ZIP file. Example:

zip example1.zip sr-report.txt

When specifying the files to be zipped, if one or more directories is to be included, you must also list the contents of the directories. For example:

zip example2.zip abc.txt def/*.png def/*.jpg

To confirm the contents of the zip (note that the option being specified is an ell, not a number 1 or a cap i):

unzip -l example2.zip

Opening a ZIP file

Opening a ZIP file (also unzipping a file) allows the individual files within the ZIP file to be extracted.

Below are instructions to create ZIP files, based on the operating system being used.

Windows

To extract individual files from a ZIP file using Windows:

  • Double-click on the ZIP file. A window will open showing the individual files which you can then copy elsewhere.

Mac OS X

Double-clicking on a .zip file should unzip it in the same directory that the zip is in. If it does not, check via the command line to see if it is being identified as a zip file:

file example.zip
  • If it is confirmed to be a zip file, then unzip via the command line:
unzip -d example-directory example.zip

You do not necessarily need to specify a directory name to unzip into, but if the zip was not done on a directory, all the unzipped files will be in the directory you're in when you run the command. With an extra command, you could check the contents of the zip before unzipping:

unzip -l example.zip

If no directory is shown, specify a directory to unzip into when you unzip it; if a top-level directory is shown that contains all the files, you don't need to specify it.

If it is not identified as a zip file, try to contact whoever provided it to discover what might have happened.

Linux and other Unix-based systems

To extract individual files from a ZIP file using Linux and other Unix-based systems (including OS X):

  • From the command line, type unzip followed by the name of the ZIP file. The individual files will be placed into the current directory, or subdirectories if they are set so.