Compression and extraction

Packing, or compressing, files means that one or more files (or folders) are made into one compact package. When you compress your files, the original files will remain in the original location, so you can safely pack them without worrying about losing them. Unpacking means that the compressed files are “decompressed” to their original size.

Why compress files?

Compressing is mainly used for the following purposes:

  1. A compressed file takes up less storage space. A smaller file can be transferred faster between locations e.g. on the Internet.
  2. Several files and folders are combined into one package that is easy to manage; it is usually easier to handle one file than a set of, say, 10,000 files.

zipper on the top of the folder and zip file extension in the pictureThe file icon or the .zip extension will tell you that a file is compressed.

How much use is compression to you? The following image shows a real-life example with the uncompressed (docx) file and compressed (zip) file of a student’s pro-seminar project. Note the considerable difference in file size!

the uncompressed file in the image is ten times larger

Note that compressed files have to be extracted before they can be opened in their respective applications.

When to compress files

The following are some situations where it makes sense to compress files:

  • A file takes up a great deal of space on the hard drive, USB flash drive or other storage medium.
  • You want to archive a file in compact form because you will not be needing it for a long time.

You are going to send several small files to a friend by e-mail. Attaching a compressed folder to an e-mail is easy, while attaching an uncompressed folder is usually impossible. The image below shows an uncompressed and a compressed folder.

  • zipper on the top of the folder and zip file extension in the picture

Note that certain types of files are already compressed. For example, JPEG and PDF files may not be compressed at all, whereas a photograph in TIFF or BMP format may be compressed to a fraction of its original file size.

Really large files should not be sent via e-mail at all, as they can completely fill the recipient’s mailbox. In addition, the file transfer may be very slow. You can share large files through online file sharing services or on a USB flash drive, for example.

Common compression and extraction methods

One of the most commonly used compression methods is ZIP compression. Most operating systems have a pre-installed program for ZIP compression or “zipping”. If you have an older operating system, you may have to install a separate ZIP program.

Popular compression methods include:

Compression method Operating-system support for this compression method
zip Both Windows and Linux as well as Mac OS can handle zip files, usually without having to install a separate zip program.
rar Usually requires installing a separate compression/extraction program (e.g. WinRAR).
gz Gz packages are common in Linux and unix, which usually have their own default applications for handling them, such as gzip. For Windows and Mac OS, there are separate programs with which you can open gz files.
7z The file extension of the 7-Zip packing application.

Note that many programs for compression and extraction know how to handle different compression types. When you have installed a compression program, you can pack and unpack files or packages consisting of several files. All compression/extraction programs usually work alike. When you know how to use one program, you probably know how to use them all.

Compressing files as zip packages

Windows 7 has a pre-installed program for compressing and extracting files. To compress files with it, follow these steps:

  • go to the folder which contains the file or subfolder you want to compress. Note that the file you are about to compress must not be open in any program.
  • Right-click the file or folder.  Select Send to, and then in the next submenu, select Compressed (zipped) folder. Here is the pop-up menu:

with send to - compressed folder selected in the context menu

The compression program will pack the selected file or subfolder into the same folder where the original file is located.

Extracting a Zip package

kontekstivalikossa valittuna extract all

When you extract a zip package, the extracted file is usually stored in a separate folder. After extraction, you can delete the zip file if you wish. Zipping programs do not usually delete the original package after extraction.

When you wish to extract a zip file, save it to a folder. Then, right-click the package and select Extract All.  Next, select the folder where you want to extract the package. The program will suggest a folder to you. If you want to extract to that folder, click Extract. If you want to change the folder, click Browse and then select the folder you want. Then proceed by clicking Extract.

The extraction program will extract the file into the directory you have selected.

Windows Unzip Dialog Box

Depending on the operating system and installed programs, you may not be able to compress and extract files in the way described hereinabove. Compression programs that are not operating system-specific – like 7-Zip, which is used in some environments – may work differently. If you use 7-Zip, you may wish to read the instructions for extracting compressed files with 7-Zip.