Child pages
  • Miscellaneous Operations - UNIX

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added external links, more formatting

...

Anchor
_Toc384453977
_Toc384453977
Anchor
_Toc384524347
_Toc384524347
Anchor
_Toc28771125
_Toc28771125
Anchor
_Toc38702799
_Toc38702799
Anchor
_Toc413923055
_Toc413923055
Overwriting Files

overwrite

When you add or extract files, the target archive or directory may already contain files that have the same names as the files you are adding or extracting. Use the overwrite option to tell PKZIP how to proceed.

Available choices are represented by the sub-options described in the following table.This table describes the available sub-option choices for overwrite:

Sub-Option

Description

For example

all

(Default) PKZIP overwrites all same-named files without prompting first

pkzipc -extract -overwrite=all test.zip *.bmp

pkzipc -add -overwrite test.zip *.bmp

prompt

PKZIP prompts you whether to overwrite a same-named file before proceeding

pkzipc -extract -overwrite=prompt test.zip *.bmp

pkzipc -add -overwrite=prompt test.zip *.bmp

increment

Increment file name to make it unique.

pkzipc -extract -overwrite=increment test.zip *.bmp

pkzipc -add -overwrite=increment test.zip *.bmp

never

PKZIP does not overwrite any same-named files

pkzipc -extract -overwrite=never test.zip *.bmp

...

Anchor
_Toc384453982
_Toc384453982
Anchor
_Toc384524353
_Toc384524353
Anchor
_Ref387047196
_Ref387047196
Anchor
_Ref387047211
_Ref387047211
Anchor
_Ref389883210
_Ref389883210
Anchor
_Ref389883280
_Ref389883280
Anchor
_Toc28771134
_Toc28771134
Anchor
_Toc38702807
_Toc38702807
Anchor
_Toc413923056
_Toc413923056
Anchor
ZipContent
ZipContent
Viewing the Contents of a ZIP File

view

PKZIP allows you to view the contents of a .ZIP file, without performing any action on that .ZIP file (for example, compress or extract). To view a .ZIP file, use the view option with PKZIP, as in the following example:

...

To display a more compact (brief) view of a .ZIP file, use the brief value with the view option, as in the following example:

pkzipc -view=brief test.zip

When you press ENTER, information similar to the following appears:

...

The rename option is particularly useful when adding or extracting streamed data. (See "Adding Data from STDIN or Special Files" in Chapter 3 and "Extracting Data to STDOUT or Special Files." in Chapter 4.)

For example, PKZIP can read data from standard input (STDIN) and add it to an archive. To tell PKZIP to get data from STDIN, a hyphen is used in place of a file name in the command line, and the data is referenced by a hyphen, not a file name, in the archive. Using the rename option, you can replace the hyphen with a file name when adding the data.

...

Anchor
_Toc28771123
_Toc28771123
Anchor
_Toc38702798
_Toc38702798
Anchor
_Toc413923060
_Toc413923060
Anchor
_Toc28771137
_Toc28771137
Anchor
_Toc38702810
_Toc38702810
Translating End-of-Line Sequence

translate

The translate option translates text end-of-line characters to the character sequence used by a different platform. The option can be used with add or extract. Specify a sub-option from the following table to translate line endings to the sequence used by the desired platform.

...

The substitution option can also insert a timestamp in the same way in the name of a destination directory specified as a sub-option of the archiveeach option.

Note: See "Time Stamping Your Signed ZIP Archive" in Chapter 3 for information on using an independent Time Stamp Authority to securely establish when a file was created or modified.

...

The following command line adds files to an archive having this name and includes the substitution option to tell PKZIP to replace the tokens with their system values:

pkzipc add -substitution "Design Spec {yyyy}-{mm}-{dd}-{h}-{MM}-{SS}{ampm}.zip" plan.doc

If the current date and time are August 09, 2014 12:06:29 a.m., the resulting archive will be named Design Spec 2014-08-09-12-06-29am.zip.

The substitution option can also be used to embed a timestamp in the name of a destination directory specified with the archiveeach option. For example:

...

The preceding command line causes each file zipped from the myfiles directory to be added to its own archive in a directory named newzips 2014-08-09-12-06-29am.zip if the date and time are August 09, 2014 12:06:29 a.m.

...

The warning option can be used with the add, extract, test, and view commands. See Appendix B this page for a list of error and warning conditions.

...

The error option can be used with add, extract, test, and view. See Appendix B this page for a list of error and warning conditions.

Anchor
_Toc28771139
_Toc28771139
Anchor
_Toc38702812
_Toc38702812
Anchor
_Toc413923067
_Toc413923067
Ignoring Warnings

IgnoreWarnings

The IgnoreWarnings option enables you to designate warnings, by number, to display, but not affect the program's return code. That is, PKZIP will not return the value 1 when ignored warnings occur.

...

The IgnoreWarnings option can be used with add, extract, test, and view. See Appendix B this page for a list of error and warning conditions.

Previewing Command and Option Operations

preview

PKZIP allows you to preview the results of a set of commands and options. The commands and options specified will be completed and the resulting output will display, but no changes will be made that result in creating a new .ZIP file or in modifying an existing .ZIP file. For example, if you wish to preview an add operation without creating or modifying any files, enter the following:

...

Anchor
_Toc413923075
_Toc413923075
Logging Events

LogError, JobID, Log, logaudit, LogOptions

You can have PKZIP log records of warnings, errors, and normal operations. Records can be written to STDOUT, STDERR, the native system logging facility (syslog) for your platform, or to a file.

The log option controls the logging of messages that relate to normal operations of PKZIP. The logerror option controls the logging of messages that relate to errors and warnings. Sub-options enable you to direct output.

On UNIX, log entries sent to the syslog are prefixed with a datestamp followed by PKZIP[XX], where XX is the number of the process ID of the PKZIP invocation that generated the message. With this information, you can identify messages that relate to PKZIP and determine which PKZIP messages belong to which process when more than one PKZIP process is running.

...

You can log entries to syslog and/or any one of the following destinations: STDOUT, STDERR, or a file. So, for example, the log setting in the following example is allowed, but a setting of log=stderr,mylog.txt would produce an error:

pkzipc -log=syslog,mylog.txt -logoptions=start -jobid=my_id2 -add myarchive.zip bookmark.htm

...

Anchor
_Toc413923076
_Toc413923076
Sending Information to an SNMP Host

SnmpTrapHost

SNMP (Simple Network Management Protocol) is a standard protocol for monitoring and managing activity on a network. It provides for applications to send messages, called SNMP traps, to an SNMP receiver application on a network server to inform the receiver application of selected events such as error and warning conditions. PKZIP can also send traps on application startup and shutdown.

...

The SnmpTrapHost option enables you to specify an SNMP host machine running an SNMP receiver for PKZIP to send SNMP traps to. The option can be configured for use by default. You specify the traps you want to send by setting sub-options for the log, logoptions, and logerror options.

Note: PKWARE sends SNMP version 2 traps, using the UDP protocol (User Datagram Protocol). Version 2 traps are not encrypted; PKWARE SNMP traps are intended to be used within a mostly trusted internal network, not across the Internet at large.

The SnmpTrapHost option takes a three-part value consisting of an SNMP host name or IP address, an optional community name, and an optional port number. The syntax is as follows (optional fields set off by brackets; do not type the brackets):

-snmptraphost=[community@]host[:port]

...

The following sample command lines use SnmpTrapHost to specify an SNMP host to receive traps sent for an add and an extract operation, respectively. The type of trap that may be sent—informational, warning, or error—depends on how the log and logerror options are set (see the next section, "Kinds and Contents of SNMP Traps Sent").

pkzipc -add mydocs.zip *.doc -snmptraphost=nmsnode1
pkzipc -extract backup1.zip -snmptraphost=private@hostxyz:20001

...

The following table lists the kinds of events for which PKZIP sends traps and the option settings that cause traps to be sent. (See the section "The PKWARE MIB," below, for information about trap names such as pkZipInfoTrap.)

Table: SNMP Traps

Event

Type of Trap

Option Setting to Send Trap

Application startup

Informational (pkZipInfoTrap)

-logOptions=start

Application shutdown

Informational (pkZipInfoTrap)

-logOptions=stop

Normal operation

Sends a trap for each normal operation that generates a message to STDOUT

Informational (pkZipInfoTrap)

-log=snmp

Warning condition

Warning (pkZipWarnTrap)

-logerror=snmp

Error condition

Error (pkZipErrTrap)

-logerror=snmp

Anchor
_Ref81376098
_Ref81376098
Anchor
_Toc413923078
_Toc413923078
Anchor
MIB
MIB
The PKWARE MIB

...

Anchor
_Toc413923079
_Toc413923079
Setting Execution Priority

priority

 The priority option sets the execution priority of PKZIP with regard to other programs running on the same system.

...