11.860 bytes

Service Hints & Tips

Document ID: DJON-3G2TAK

Aptiva - Using the PKZIP/PKUNZIP utilities

Applicable to: United States

This article discusses how to use the PKZIP and PKUNZIP shareware programs by PKWARE, Inc. The PKZIP/PKUNZIP programs compress and uncompress your program and data files. Data compression is a method used to increase your disk storage capacity. Operating system data compression programs like IBM PC DOS 7's Stacker 4.0 and MS-DOS 6.22's DriveSpace store data in a compressed format on your hard drive or a diskette and then uncompress the data as it is read into memory. Other programs compress your directories and files by using the command line interface in DOS to "zip" the data to your hard drive or diskette. PKZIP is an example of such a program. Zipping a file refers to a specific method/program used to compress a file. "Unzipping" a file refers to uncompressing a zipped file. The PKUNZIP program will unzip files compressed by PKZIP. Zipped files typically have a file extension of .ZIP.

Several examples of how you can use zipped files include:

1. Archive data not required to be online.

2. Copy files that are larger than a single diskette (spans multiple diskettes).

3. Transport data from one machine to another.

4. Back up your hard drive.

5. Restore pre-loaded, original PS/1 - Aptiva software.

Most files available for download from bulletin boards and other online services are zipped (compressed) to save space and to reduce download time. Another example of how zipped files are used can be found in the IBM PS/1 and early Aptiva models. These machines include a Recovery directory that contains a compressed image of the software pre-loaded onto the PS/1 and Aptiva personal computers. You can use the Recovery files to either restore all of your original software or to restore individual directories and files. The PKZIP/PKUNZIP examples that follow present a few of the common ways to use these programs.

NOTE: PKZIP/PKUNZIP help screens can be accessed by typing 'PKZIP/?' or 'PKUNZIP/?' at the command prompt.

PKZIP/PKUNZIP EXAMPLES...

In the first example, we will compress a single file on your hard drive to a diskette. The file to be compressed is MYFILE.TXT and is in a directory called MYDIR. The compressed filename will be ANYNAME.ZIP. The command format is:

PKZIP A:\ANYNAME.ZIP C:\MYDIR\MYFILE.TXT

To restore (unzip) MYFILE.TXT to its original directory, you could use the following command format:

PKUNZIP A:\ANYNAME.ZIP MYFILE.TXT C:\MYDIR

To restore (unzip) MYFILE.TXT to a different directory (YOURDIR), you could use the following command format:

PKUNZIP A:\ANYNAME.ZIP MYFILE.TXT C:\YOURDIR

Execution of this command would create a new directory called YOURDIR (if it did not previously exist) and unzip the MYFILE.TXT file into the new YOURDIR directory.

To use PKZIP to compress a directory called MYDIR and all of its subdirectories and files, enter the following:

PKZIP A:\ANYNAME.ZIP C:\MYDIR\*.* -RP

The "RP" switch enables you to include subdirectories in the .ZIP file. If the directory(s) you want to compress spans more than one diskette, you can use the "-&RP" switch. The "&" tells PKZIP to create a .ZIP file and span multiple diskettes, if required. If the "&" switch is not specified and you exceed the capacity of a floppy disk, a DISK FULL error message will result. To restore the MYDIR directory and all of its subdirectories and files, use the following command format:

PKUNZIP A:\ANYNAME.ZIP C:\ -OD

The "O" and "D" switches tell PKUNZIP to overwrite (O) any existing files and to recreate zipped directories (D) on extraction. A rule to remember is if you zip with -RP, unzip with -OD. Caution! When you use the "-RP" switch, PKZIP creates a directory structure in the .ZIP file. You may include or ignore this directory structure when you unzip the files depending on the command syntax used. If you have a .ZIP file and are unsure of how its files were zipped, you can list the contents of a .ZIP file (ANYNAME.ZIP in this example) by entering the following command:


PKUNZIP A:\ANYNAME.ZIP -V


I recommend that you use this command to observe the structure of a zipped file to determine if it includes subdirectories with files or files alone. It is important to know the .ZIP structure before you attempt to unzip the files to prevent creating unwanted subdirectories. For example, if your zipped file structure looked like the following: MYDIR\MYFILE.TXT and you used the following command to unzip this file:

PKUNZIP A:\ANYNAME.ZIP MYDIR\MYFILE.TXT C:\MYDIR -OD


the PKUNZIP program would create a new entry on your hard drive as follows:

C:\MYDIR\MYDIR\MYFILE.TXT

If you ever noticed duplicate directories on your hard drive after using the PKUNZIP command, it was probably due to a syntax error. The proper syntax to unzip MYFILE.TXT in the previous example is:

PKUNZIP A:\ANYNAME.ZIP MYDIR\MYFILE.TXT C:\ -OD

PKUNZIP will correctly place the unzipped MYFILE.TXT into the MYDIR directory. If the MYDIR directory does not exist on your hard drive, PKUNZIP will create one. The PKZIP/PKUNZIP syntax is very flexible and should be used with caution until the command syntax is understood.

USING THE RECOVERY DIRECTORY...

Some IBM Aptiva models and PS/1's with a Recovery directory include a copy of the PKUNZIP.EXE program in the Recovery directory on the hard drive. You can use this command to restore your original, pre-loaded software or individual directories, subdirectories and files. For example, to restore your Windows directory and its subdirectories and files, exit the Windows program and enter the following at the C: prompt:

CD\RECOVERY

PKUNZIP *.ZIP WINDOWS\*.* C:\ -OD

If you need to restore a single file, use the following example. In this instance, we will restore the TOOLS.ICO file in the ICONS subdirectory of the WINDOWS directory:

CD\RECOVERY

PKUNZIP *.ZIP WINDOWS\ICONS\TOOLS.ICO C:\ -OD

Since the Recovery .ZIP file was created with a directory structure, you need only specify the "-OD" switch and the PKUNZIP program will know to restore the TOOLS.ICO file into the ICONS subdirectory of Windows. Another variation of the command to obtain the same result is as follows:


CD\RECOVERY

PKUNZIP *.ZIP WINDOWS\ICONS\TOOLS.ICO C:\WINDOWS\ICONS


Note that without the "-OD" switch, it is necessary to specify the full pathname of the target drive. If you forget and specify both the "-OD" switch and the full pathname of the target drive, the TOOLS.ICO file will be placed in the following subdirectory:

C:\WINDOWS\ICONS\WINDOWS\ICONS

If you accidentally create a directory structure that you want to delete, you can use the DELTREE command to delete it. This command is available in MS-DOS 6.0 and IBM PC DOS 6.1 and later. In this example, you can delete the WINDOWS directory and all of its subdirectories and files by entering the following command:

DELTREE C:\WINDOWS

SELF-EXTRACTING FILES...

This description on the use of the PKWARE programs would not be complete without a brief mention of self-extracting, compressed files. Self-extracting files are compressed files with a .EXE file extension that can be unzipped by executing the file. The process that creates the zipped, self-extracting file embeds the software within the file that is needed to expand (unzip) the file. For example, the latest shareware version of the PKZIP/PKUNZIP programs by PKWARE is called PKZ204G.EXE and is a self-extracting program available from many bulletin boards and online services. To install the PKZIP/PKUNZIP programs, you would download a self-extracting file called: PKZ204G.EXE to a directory called PKWARE on your hard drive. To uncompress the file, enter the following at the C: prompt:

CD\PKWARE

(change to the directory where you stored the file)

PKZ204G

(run the self-extracting, compressed file with the .EXE extension)

The PKZ204G.EXE will "explode" into its component parts. To view the expanded files afterwards, enter the following:

DIR PKWARE

Self-extracting, compressed files and regular executable files both have the same extension of .EXE. You can use the PKUNZIP command with the -V switch to determine whether a file is a self-extracting file or an executable file. Use a command similar to the following:


PKUNZIP ANYFILE.EXE -V

If the file is self-extracting, PKUNZIP will list the contents of the file. If it is an executable file, PKUNZIP will report an error.


To execute PKZIP/PKUNZIP from the command line without including the PKWARE directory in the pathname, add PKWARE to the PATH statement in the AUTOEXEC.BAT file.

OBTAINING THE PKZIP/PKUNZIP PROGRAM

You can obtain the latest shareware version of the PKWARE program from the World Wide Web. The web site is the following:

http://www.pkware.com

The PKZIP/PKUNZIP program is downward, but not upward compatible. This means that if you zip a file with PKZIP 2.04, you will need PKUNZIP 2.04 or later to unzip it. However, PKUNZIP 2.04 will unzip any .ZIP file made by any earlier version of the PKWARE PKZIP program.

For more detailed information on the PKZIP/PKUNZIP product and how to use it, consult the PKWARE documentation.

SUMMARY...
The PKWARE programs are shareware. This means that the original developer of the program would like to be paid a nominal fee for your use of the program. Information on how to submit payment for the PKZIP/PKUNZIP programs is included in the PKZ204G.EXE file.


The PKZIP/PKUNZIP programs provide a powerful set of tools to compress and uncompress your programs and data. After you have mastered the tools, you will be ready to make better use of your computer resources.

Search Keywords

DOS, Miscellaneous

Hint Category

Utility Software

Date Created

11-04-97

Last Updated

10-03-99

Revision Date

10-03-2000

Brand

IBM Aptiva

Product Family

Aptiva, PS/1

Machine Type

2134, 2136, 2137, 2138, 2140, 2142, 2144, 2159, 2161, 2162, 2168, 2176, 2011, 2121, 2123, 2133, 2155

Model

ALL

TypeModel

2011C8E

Retain Tip (if applicable)

Reverse Doclinks
and Admin Purposes