PKZIP abc's
PKZIP abc's
Following are basic examples for learning how to zip and unzip files using the DOS version of PKZIP and PKUNZIP.All files can be compressed. The amount of compression depends on the file content. Text and data files compress well. So do many .EXE files. Graphics files vary depending on the graphics format used.
Version Numbers
The current version of PKZIP/PKUNZIP that runs in the DOS or Windows command line is Version 2.50. Files zipped with previous Versions of PKZIP can be unzipped with 2.50. Unlike previous versions, PKZIP 2.50 supports long file names, but only works in Windows 9x, not Windows NT/2000. The version number is displayed on screen as the program starts processing.
Zipping
To compress one or more files, use the PKZIP command. The format of the command is:
PKZIP TO FROM
To zip everything in the current directory, creating a MUCHSTUF.ZIP file, type:
pkzip muchstuf *.*
To zip everthing in the current directory, except the .BAK files, use the -x (eXclude) switch. There can be NO spaces between the -x and the file description that follows it; for example:
pkzip muchstuf *.* -x*.bak
To zip all the .DBF files in the current directory, creating a DATA.ZIP file, type:
pkzip data *.gif
Zipping onto Another Drive
To zip files onto another disk, just add the drive letter; for example:
pkzip f:data *.gif
To zip selected files, just name them sequentially. Use path names if the files are not in the current directory. For example, presuming SALES.DBF is in the current directory, but CREDIT is not, type:
pkzip data sales.dbf \\123\\credit.wk1
Unzipping
To decompress one or more files that have been compressed with PKZIP, use the PKUNZIP command. The format of the command is:
PKUNZIP FROM (selected files)
To unzip DATA.ZIP in the current directory, type:
pkunzip data
To unzip selected files from another drive into your current directory, just name them sequentially; for example:
C:\\ANYWHERE>pkunzip b:data doc1 doc3
The .ZIP file still remains intact after exploding. Delete it if you have no further use for it.
Creating a Self-extracting Archive
Once a zip file has been created, it can be used to create a self-extracting archive with the ZIP2EXE.EXE utility. It combines PKUNZIP.EXE with the .ZIP file creating a new executable program that unzips automatically when you run it.
For example, to create the DATA.EXE self-extracting archive from the DATA.ZIP file, type:
zip2exe data
To run DATA.EXE, simply type the program name like you would any executable file:
data
To extract selected files from a self-extracting archive on a floppy, just name the files sequentially. For example, to pull out DOC5 and DOC9 from DOCUMENT.EXE on the B: drive into the current directory, type:
C:\\ANYWHERE>b:document doc5 doc9
Updating Files
You can use PKZIP to update only files that have been changed. For example, to update all the .DOC files on a floppy archive called DOCUMENT.ZIP from the current directory, type the following:
pkzip b:document *.doc -u -bc:
The -u switch means zip only files that have a more recent date than the ones on the target drive, in this case the floppy drive B:. The -bc: switch indicates that the C: drive should be used if extra room is required to do the compressing. This is a good safeguard if you are zipping files onto floppies, otherwise the operation will stop if there is not enough room.
In the above example, new .DOC files that do not already exist in the DOCUMENT.ZIP file would also be added. To update only files that already exist in the zip file without adding new ones, use the -f (Freshen) switch instead of the -u (Update) switch.
Adding Files
You can add one or more files to an existing zip file. For example, to add the file LETTER.DOC to the DOCUMENT.ZIP file, type:
pkzip document letter.doc
Deleting Files
You can delete one or more files from an existing zip file by using the -d switch. For example, to delete LETTER.DOC from DOCUMENT.ZIP, type:
pkzip document letter.doc -d
Reviewing the Status of Zipped Files
To see how much a zipped archive has been compressed, use the /v switch. For example, to review the status of all the files that have been zipped in the DOCS archive, type:
pkzip docs /v
Zipping Subdirectories
You can zip files and subdirectories attached to the current directory. When you unzip them, the subdirectories will be created automatically.
For example, assume two subdirectories named JACK and JILL in the root directory. To zip all the files in JACK and JILL, use the upper case -P switch:
C:\\>pkzip new jack\\*.* jill\\*.* -P
When you unzip NEW.ZIP using the -d switch, the JACK and JILL subdirectories will be created, if they do not exist, subordinate to the directory you are currently in. For example, if you are in the DATA directory, \\DATA\\JACK and \\DATA\\JILL will be created. Note the following syntax:
C:\\DATA>pkunzip a:new -d