PKZIP Command Line Reference

This document was created to introduce you to the new command line version of PKZIP. One of the most significant differences between this version of PKZIP and previous versions of PKZIP/PKUNZIP is the consolidation of compression and extraction (zip/unzip) functionality into a single program. In other words, the same program compresses and extracts files. Additionally the command line syntax has been changed. This was done to make PKZIP easier to understand and use for the novice and power user alike. Hopefully, you will find all of the functionality of previous versions of PKZIP with a simpler more intuitive user interface.

Please keep in mind that although this document does include basic information to help you get started using PKZIP, it is not a user's manual. The Registered and Licensed versions of PKZIP come with extensive documentation including a comprehensive user's manual. The PKZIP user's manual includes such things as tutorials as well as in depth discussions of PKZIP's advanced features.

PKZIP Usage:

Usage: PKZIP [command] [options] zipfile [@list] [files...]

Examples:

     View zip file contents: PKZIP zipfile

     Create a zip file: PKZIP -add zipfile file(s)...

     Extract files from zip: PKZIP -extract zipfile

These are only basic examples of PKZIP's capability

PKZIP Command Reference:

An alphabetical listing of available PKZIP commands and options follows. You may wish to scroll through the entire list or click on one of the hyperlinks below to go directly to the specified command/option section.

PKZIP Commands:

Add

Comment

Configuration

Console

Default

Delete

Extract

Fix

Header

Help

License

Print

Sfx

Test

Version

View

PKZIP Options:

204

After

Attributes

Before

Comment

Directories

Exclude

Fast

Filetype

Header

ID

Include

Level

Links

ListChar

ListSfxTypes

Locale

Mask

Maximum

More

Move

NameSfx

NameType

NoExtended

NoFix

Normal

NoZipExtension

OptionChar

Overwrite

Password

Path

Permission

Preview

Recurse

Sfx

Shortname

Silent

Sort

Span

Speed

Store

Temp

Times

Volume

Warning

Zipdate

 

This document contains reference information on every PKZIP command and option. For each command/option, the following information is provided:

Category:

Represents:

Name/Description

The full name of the command/option and a brief description of what that command/option does.

If the command/option can be configured (defaulted) in the Configuration file, the word "configurable" appears after the description.

Value(s)

The value(s) associated with this command/option, including the "default" value for each.

If a command/option does not have a value, the word none appears.

Example usage

An example of how to include this command/option in your PKZIP command line, including possible abbreviations. For most options, you can abbreviate the command/option. These abbreviations are illustrated in the examples used in this appendix.

Used with

This command can be used for compression, extraction, viewing, testing, a combination, or as a stand-alone (none of the above).

 

Information on each command/option follows:

Name/Description:

Value(s):

Example usage:

Used with:

204

turns on PKZIP for DOS 204g compatibility

configurable

none

-----------------------------

no default value

pkzip -add -204 save.zip *

add

Name/Description:

Value(s):

Example usage:

Used with:

add

add files to a .ZIP file

configurable

all - compress new files and all existing files

freshen - compress only files that exist in the .ZIP and that have changed

update - compress new and update existing files

incremental - compress only files that have the archive attribute on and subsequently turns off the archive attribute (DOS, OS/2)

-incremental - compress only files that have the archive attribute on and does not turn off the archive attribute (DOS OS/2)

-----------------------------

default = all

pkzip -add save.zip *.doc

pkzip -add=freshen save.zip *.doc

pkzip -add=increm save.zip *.doc

pkzip -add=-increm save.zip *.doc

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

after

process files that are newer than, or equal to, a specified date

configurable

any date in format specified in Country-Settings or the locale option

e.g. the US date format is:

mmddyy

or

mmddyyyy

-----------------------------

no default value

for compression:

pkzip -add -aft=091595 save.zip *.doc

for extraction:

pkzip -ext -after=091595 save.zip *.doc

add, extract, delete, test, view

Name/Description:

Value(s):

Example usage:

Used with:

attributes

stores files with the specified file attribute information in the .ZIP file

configurable

(DOS, OS/2)

hidden - compress hidden files

system - compress system files

readonly - compress read-only files

all - compress all types of files

none - donÆt compress files that have hidden, system, or read-only attributes; overrides the default attributes setting in config file

-----------------------------

default = readonly

default if used on command line without a sub-option = all

pkzip -add -attr=system,hidden save.zip *

add

Name/Description:

Value(s):

Example usage:

Used with:

before

process files that are older than a specified date

configurable

any date in format specified in Country-Settings or the locale option

e.g. the US date format is:

mmddyy

or

mmddyyyy

-----------------------------

no default value

for compression:

pkzip -add -bef=091595 save.zip *.doc

for extraction:

pkzip -ext -bef=091595 save.zip *.doc

add, extract, delete, test, view

Name/Description:

Value(s):

Example usage:

Used with:

comment

include a text comment for individual files within a .ZIP file

configurable

all - all files within .ZIP file

unchanged - only existing files that have not changed

add - only new files

freshen - only existing files

update - existing and new files

none - Turn off comment

-----------------------------

default = add

pkzip -add -com=all save.zip *.doc

 

add

Name/Description:

Value(s):

Example usage:

Used with:

configuration

define default values for most PKZIP commands/options

any configurable command or option

-----------------------------

no default value

pkzip -config -extract=freshen

to see the current configuration values, type:

pkzip -config

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

console

perform a "mock" extract and display files on your screen

(DOS, OS/2)

none

-----------------------------

no default value

pkzip -console save.zip *.txt

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

default

reset the original defaults for the commands-options in the config file

none

-----------------------------

no default value

to reset all defaults:

pkzip -default

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

delete

remove files from a .ZIP file

file(s) to delete

-----------------------------

no default value

for individual files:

pkzip -del save.zip doc1.txt

for a specific file pattern:

pkzip -del save.zip *.doc

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

directories

store directory path names during compression, or recreate directory path names while extracting

includes subdirectories (recurse)

configurable

note: using this command is the same as combining the path and recurse commands

current - store path information relative to the current path (or for files specified)

root or full - store the entire path beginning at the root directory

specify - store the path information for each file being compressed (or recreates for each file being extracted), as specified on the command line

relative - store the directory path relative to the current working directory of the drive(s) specified (DOS)

none - overrides directory path information in configuration file

-----------------------------

default = none

default if used on command line without a sub-option = current

compression example (assumes you are in "/wp"):

pkzip -add -dir=root save.zip wp/docs/*

the path stored would be "wp/docs/*"

pkzip -add -dir=current save.zip wp/docs/*

the path stored would be: "docs/*"

extraction example:

pkzip -ext -direct save.zip /*

 

add, extract

Name/Description:

Value(s):

Example usage:

Used with:

exclude

exclude files from being compressed or extracted

configurable

note: you must specify a sub-option (e.g. file name or file pattern) with the exclude option

the file(s) or file pattern (for example, *.doc) being excluded

-----------------------------

no default value

compression example:

pkzip -add -excl=*.doc save.zip

extraction example:

pkzip -ext -excl=*.txt save.zip

setting exclude default:

pkzip -config -excl=*.txt

note: when you use the exclude option with the configuration command, PKZIP prompts you to configure the exclude default for add and/or extract operations

add, extract, delete, test, view

Name/Description:

Value(s):

Example usage:

Used with:

extract

extract files from a .ZIP file

configurable

all - all files in .ZIP file

freshen - only files in the .ZIP file that exist in the target directory and that are "newer" than those files will be extracted

update - files in the .ZIP file which already exist in the target directory and that are "newer" than those files as well as files that are "not" in the target directory will be extracted

-----------------------------

default = all

pkzip -ext=up save.zip

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

fast

set the level of compression to "fast" or level 2

configurable

none

-----------------------------

no default value

pkzip -add -fast save.zip *.doc

pkzip -config -fast

add

Name/Description:

Value(s):

Example usage:

Used with:

filetype

processes files with the specified file type information in the .ZIP file

(UNIX)

 

hidden - include/exclude filenames that have a dot "." in the first position of the filename (e.g. .profile)

pipe - include/exclude pipe files. These are files having a file mode starting with "p" (e.g. prwxrw-rw-)

slink - include/exclude symbolic links. These are files having a file mode starting with "l" (e.g. lrw-rw-rw-)

hlink -include/exclude linked file. These are linked files that are not symbolic links. They are files with a link count > 1 (hard link)

none - exclude all of the above file types; Generally, this option should be followed by one, or more, file types. This results in just the type(s) specified being included in the ZIP file. For example, -FILETYPE=NONE,PIPE results in only PIPE files being included

all - include all of the above file types

regular - include/exclude regular files

-----------------------------

default = regular

pkzip -filetype=+hidden save.zip

add, extract

Name/Description:

Value(s):

Example usage:

Used with:

fix

recover a corrupt .ZIP file

none

-----------------------------

no default value

pkzip -fix save.zip

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

header

create a comment for a .ZIP file, which will appear in the header area of the .ZIP file

configurable

a text string or file specified with a list file character (e.g. @) that represents the header information

-----------------------------

no default value

to include specific text:

pkzip -add -hea save.zip *.doc

note: when you type this command, PKZIP will prompt you for the header text

to include an existing file:

pkzip -add -hea=@text.doc save.zip *.doc

add, stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

help

display Help for PKZIP

any command or option for which help is desired

-----------------------------

no default value

pkzip -help

pkzip -help=add

in this example you are specifying a specific command (add) for which you wish to view the Help file

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

id

preserve the user ID (UID) and/or group ID (GID) on extraction

(UNIX)

uid - retain the user ID on extraction

gid - retain the group ID on extraction

-----------------------------

no default value

pkzip -extract -id=uid

extract

Name/Description:

Value(s):

Example usage:

Used with:

include

include files to compress or extract

configurable

note: you must specify a sub-option (e.g. file name or file pattern) with the include option

the file(s) or file pattern (for example, *.doc) being included

-----------------------------

no default value

pkzip -add -include=*.doc save.zip

in this example, only .DOC files will be compressed

pkzip -config -include=*.txt

in this example, you are setting up .txt files as the files that you always want to compress or extract, until you change the default or override from the command line with the exclude option

note: when you use the include option with the configuration command, PKZIP prompts you to configure the include default for add and/or extract operations

add, extract, delete, test, view

Name/Description:

Value(s):

Example usage:

Used with:

level

set the level of compression

configurable

any digit from 0 through 9, with 0 being no compression at the fastest speed, and 9 being the most compression at the slowest speed

-----------------------------

default = level 5 (normal)

pkzip -add -lev=9 save.zip *.doc

add

Name/Description:

Value(s):

Example usage:

Used with:

license

display the product license information for PKZIP

none

-----------------------------

no default value

pkzip -lic

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

links

specify that linked files be followed or preserved in a .ZIP archive

(UNIX)

hlink - hard links should be followed rather than preserved

slink - symbolic links should be followed rather that preserved

 

-----------------------------

no default value

pkzip -add -links=hlink

add, filetype

Name/Description:

Value(s):

Example usage:

Used with:

listchar

set the list character to the specified ASCII character for list files

configurable

any valid single character

-----------------------------

default = @

pkzip -config -listchar=#

add, extract, delete, test, view

Name/Description:

Value(s):

Example usage:

Used with:

listsfxtypes

display a list of the types of SFX files that can be created with PKZIP

none

-----------------------------

no default value

pkzip -listsfxtypes

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

locale

change the system locale environment value that defines the valid formats for all date and time fields entered using PKZIP

configurable

(OS/2)

a valid country name (e.g. us, germany, france)

environment - PKZIP will attempt to use the environment variable defined by the operating system

-----------------------------

default = US

default if used on command line without a sub-option = environment

pkzip -config -locale=germany

pkzip -add -locale=germany test.zip *.DOC

pkzip -add -locale=environment test.zip *.DOC

add, extract

Name/Description:

Value(s):

Example usage:

Used with:

locale

use the date and time format that is defined by the operating system

configurable

(DOS, UNIX)

none

-----------------------------

default = no default value

pkzip -config -locale

pkzip -add -locale test.zip *.DOC

add, extract

Name/Description:

Value(s):

Example usage:

Used with:

mask

remove file attributes of files within a .ZIP file or when extracting

note: you can only remove the attributes that have been stored, as defined by the attribute command

configurable

(DOS, OS/2)

hidden - hidden attributes

system - system attributes

readonly - read-only attribute

none - no attributes (turns off attribute mask in the PKZIP Configurations Settings file for this instance only)

all - all attributes

-----------------------------

default (compress) = none

default (extract) = all

default if used on command line without a sub-option (compress and extract) = all

pkzip -add -attr=hidden
-mask=hidden save.zip

pkzip -extract -mask=none save.zip

pkzip -config -mask=hidden

note: when you use the mask option with the configuration command, PKZIP prompts you to configure the mask default for add and/or extract operations

 

add, extract

Name/Description:

Value(s):

Example usage:

Used with:

maximum

set the level of compression to the highest level, but lowest speed

configurable

none

-----------------------------

no default value

pkzip -add -max save.zip *.doc

pkzip -config -max

add

Name/Description:

Value(s):

Example usage:

Used with:

more

pause after one screen of output and prompt to continue

configurable

the number of rows of information you want to consist of a screen

-----------------------------

default = one screen of information

pkzip -view -more=22 save.zip

pkzip -config -more

note: when you use the more option with the configuration command, PKZIP prompts you to configure the more default for add, extract, and/or view operations

all commands

Name/Description:

Value(s):

Example usage:

Used with:

move

remove the files from the source drive after compression (files will reside only in .ZIP file)

configurable

none

-----------------------------

no default value

pkzip -add -move save.zip *.doc

add

Name/Description:

Value(s):

Example usage:

Used with:

namesfx

specify a file name when converting to a self-extracting file

a valid file name (e.g. filename.exe)

-----------------------------

no default value

pkzip -sfx -namesfx=test.exe docs.zip

sfx

Name/Description:

Value(s):

Example usage:

Used with:

nametype

specify the format in which you wish to extract file(s)

configurable

(DOS, OS/2)

auto - auto-detection of file system and extraction format

short - files are extracted in 8+3 format

long - files are extracted in same format that they were originally added in

-----------------------------

default = auto

default if used on command line without a sub-option = short

pkzip -extract -nametype=long test.zip /temp

extract

Name/Description:

Value(s):

Example usage:

Used with:

noextended

suppress the storing or extracting of extended attribute information within the .ZIP file

configurable

none

-----------------------------

no default value

pkzip -add -noextended save.zip *

add

Name/Description:

Value(s):

Example usage:

Used with:

nofix

suppress the "attempt to fix" prompt if PKZIP encounters errors in a .ZIP file

configurable

none

-----------------------------

no default value

pkzip -add -nofix save.zip *.doc

add, extract, delete, test, view

Name/Description:

Value(s):

Example usage:

Used with:

normal

set the level of compression to 5, the best balance of compression and speed

configurable

none

-----------------------------

no default value

pkzip -add -normal save.zip

pkzip -config -normal

add

Name/Description:

Value(s):

Example usage:

Used with:

nozipextension

suppress the adding of a .ZIP extension to the .ZIP file name

configurable

none

-----------------------------

no default value

pkzip -add -nozipextension file.ibm *.doc

all commands

Name/Description:

Value(s):

Example usage:

Used with:

optionchar

set the option character to the specified ASCII character

configurable

any valid single character

-----------------------------

default = - (dash)

pkzip -opt=# #add save.zip *.doc

pkzip -config -option=+

all commands

Name/Description:

Value(s):

Example usage:

Used with:

overwrite

determine whether or not to overwrite files on your hard drive with the files being extracted

configurable

 

prompt - prompt every file individually on whether to overwrite a file that has the same name as the one being extracted

all - overwrite all files that have a corresponding file on the hard drive

never - never overwrite a file that has a corresponding file on the hard drive

-----------------------------

default = prompt

default if used on command line without a sub-option = all

pkzip -ext -over=all save.zip

 

extract

Name/Description:

Value(s):

Example usage:

Used with:

password

include a password with your .ZIP file

configurable

your password, or no value

-----------------------------

no default value

to include password in the command:

pkzip -add -pass=baseball save.zip

to have PKZIP prompt you for a password "after" you type the command:

pkzip -add -pass save.zip

add, extract, test

Name/Description:

Value(s):

Example usage:

Used with:

path

store directory path names for files within a .ZIP file

configurable

current -stores the path from the current directory

root/full - store the entire path beginning at the root of the drive; also referred to as "full" path

specify - store the path as specified in your pkzip command

relative - store the directory path relative to the current working directory of the drive(s) specified (DOS)

none - no path information stored

-----------------------------

default = none

default if used on command line without a sub-option = current

assuming in you are in "/temp":

pkzip -add -path=root save.zip docs/*

(the path stored would be "temp/docs/")

pkzip -add -path=current save.zip wp/docs/*

(the path stored would be "docs/*")

 

add

Name/Description:

Value(s):

Example usage:

Used with:

permission

preserve the original file access permissions of an extracted file

(UNIX)

none

-----------------------------

no default value

pkzip -extract -permission save.zip

 

extract

Name/Description:

Value(s):

Example usage:

Used with:

preview

preview the results of a set of commands or options without actually performing the task represented by that command/option

none

-----------------------------

no default value

pkzip -add -preview save.zip

 

add

Name/Description:

Value(s):

Example usage:

Used with:

print

print a file within a .ZIP file

(DOS, OS/2)

the print device use, for example, "lpt1"

-----------------------------

default = the default printer on your system

pkzip -print=lpt1 save.zip readme.txt

if you do not specify a print device, the "default" printer is used

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

recurse

search subdirectories for files to compress

configurable

none

-----------------------------

no default value

pkzip -add -rec save.zip addendum.doc

add

Name/Description:

Value(s):

Example usage:

Used with:

sfx

create a self-extracting .ZIP file (.EXE file), or convert an existing .ZIP file to a .EXE file

configurable

dosfull - create a DOS- formatted self-extractor

jrdos - create a DOS junior self-extractor

win16 - create a Windows 16-bit self-extractor

(native self extractor for the operating system on which you are running PKZIP)

-----------------------------

default = (native self extractor)

for a new .ZIP file:

pkzip -add -sfx save

to convert an existing .ZIP file:

pkzip -sfx save.zip

add, stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

shortname

convert .ZIP file name in long file name format to a DOS or equivalent "short" file name

note: PKZIP includes sub-options for both and DOS because of the differences in the way each OS handles short file names

configurable

dos - convert .ZIP file to a dos-equivalent short file name

os2 - convert .ZIP file to an -equivalent short file name

-----------------------------

default = dos

pkzip -add -short=dos save.zip

add

Name/Description:

Value(s):

Example usage:

Used with:

silent

suppress all screen display output

configurable

note: errors and warnings are displayed whether the silent option is specified or not, however, prompts for other PKZIP operations are not displayed (e.g. Password)

none

-----------------------------

no default value

pkzip -add -silent save.zip *.doc

all commands

Name/Description:

Value(s):

Example usage:

Used with:

sort

sort files within .ZIP file based on specific criteria (for example, by file size)

configurable

note: the crc and ratio sub-options will not work with the add command and sort option

 

crc - sort by CRC value

date - sort by file date of file

extension - sort by file extension

name - sort alphabetically by name

natural - sort in the order that the file was compressed

ratio - sort by compression ratio

size - sort by the original, uncompressed size of the file ("length" in display)

none - do not sort (same as natural)

-----------------------------

default = natural

default if used on command line without a sub-option = name

pkzip -ext -sort=ratio save.zip *.doc

pkzip -config -sort=date

note: when you use the sort option with the configuration command, PKZIP prompts you to configure the mask default for add, extract, and/or view operations

add, extract, test, view

Name/Description:

Value(s):

Example usage:

Used with:

span

forces disk spanning in the event that PKZIP is unable to detect the fact that destination directory is on removable media

note: the spanning process should proceed automatically; a command line option is usually not necessary to turn on this feature

(DOS, OS/2)

none

-----------------------------

no default value

pkzip -add -span a:\save.zip *.doc

add

Name/Description:

Value(s):

Example usage:

Used with:

speed

sets the level of compression to 1, which is the least but fastest compression

configurable

none

-----------------------------

no default value

pkzip -add -speed save.zip *.doc

pkzip -config -speed

add

Name/Description:

Value(s):

Example usage:

Used with:

store

sets the level of compression to 0 (no compression), and only stores the files within the .ZIP file

configurable

none

-----------------------------

no default value

pkzip -add -store save.zip *.doc

pkzip -config -store

 

add

Name/Description:

Value(s):

Example usage:

Used with:

temp

creates the temporary .ZIP file required by PKZIP, on specified drive

note: the temp option only works when updating an existing .ZIP file

the drive and/or path.

e.g. C: or /root/temp

-----------------------------

no default value

pkzip -add -temp=Z:\PUBLIC test.zip *.txt

this example updates the .ZIP file test.zip and uses the Z:\PUBLIC directory location for the temp file

add

Name/Description:

Value(s):

Example usage:

Used with:

test

test the integrity of files within a .ZIP file

configurable

all - all files in .ZIP file

freshen - only those files in the .ZIP file which already exist in the extract directory and that have a file modification date newer that the files already in the directory will be extracted from the .ZIP file.

update - files in the .ZIP file which already exist in the target directory and that are "newer" than those files and files that are "not" in the target directory will be extracted

-----------------------------

default = all

pkzip -test save.zip

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

times

specify whether file access, modification, and creation times are to be preserved

(DOS, UNIX)

access - restores the time of last access to files on extraction

modify - restores the time of last modification to files on extraction

create - restores the time of creation to files on extraction

-----------------------------

no default value

pkzip -extract -times=access

 

extract

Name/Description:

Value(s):

Example usage:

Used with:

version

determine the version of PKZIP you are running

note: PKZIP also returns the version number to the shell by way of setting the error level

major - returns the major version number of the release

minor - returns the minor number of the release (e.g. - if the version number is 2.5, the value returned is 5)

step - returns the step, or patch value. (e.g. - if the version is 2.04.01, the step value returned is 1)

-----------------------------

default = major

pkzip -version

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

view

display information about the files within a .ZIP file, for example, the compressed size of a file

configurable

brief - present information in the most compact manner

details - present information in the most detailed manner

normal - present information in the normal manner

-----------------------------

default = normal

pkzip -view save.zip

stand-alone

Name/Description:

Value(s):

Example usage:

Used with:

volume

store/restore the volume label with the .ZIP file

configurable

(DOS, OS/2)

a drive letter (for example, C)

-----------------------------

default = no volume label

default if used on command line without a sub-option = current drive

pkzip -add -volume=C save.zip *.docs

add, extract

Name/Description:

Value(s):

Example usage:

Used with:

warning

pause after every warning, and prompt you to continue or not

configurable

none

-----------------------------

default = disabled

pkzip -ext -warn save.zip *

add, extract, test, view

Name/Description:

Value(s):

Example usage:

Used with:

zipdate

set the file modification date of the .ZIP file

configurable

newest - set to the date of the "newest" file within the .ZIP file

oldest - set to the date of the "oldest" file within the .ZIP file

retain - retain the original date of the .ZIP file (the date on which the .ZIP file was created)

none - disable the .ZIP file date in the config file, and set the .ZIP date as the last modification date

-----------------------------

default = the current date

default if used on command line without a sub-option = retain

pkzip -add=update
-zipdate=retain save.zip *.txt

add