User's Manual

7-ZIP Archiver

Version 2.00 Beta 2

 

Go to 7-ZIP Home Page

Contents

Contents

Introduction

Zip format compatibility

Command line syntax

Commands

Switches

FAR support

Final comments

Introduction

Contents

7-ZIP Archiver is a freeware program for manipulating with ZIP file archives. 7-ZIP is a console 32-bit executable for Windows 95, 98 and NT.

ZIP format compatibility

Contents

7-Zip Archiver creates fully ZIP compatible archives. It means that everyone can decompress these files by any ZIP compatible decompression utility. During compression 7-ZIP can use one of the following ZIP compression methods:

Current version of the 7-ZIP can extract any files from ZIP archive that were compressed with one of the following methods:

Files compressed with other ZIP compression methods can't be extracted by current version of the 7-ZIP. But supported methods are the most popular now and it causes 7-ZIP can decompress the most of ZIP archives. For extracting files compressed with non-supported methods you must use some other ZIP utility.

Since all ZIP compression methods supported by 7-ZIP compression engine also are supported by 7-ZIP decompression engine then any ZIP archive created by 7-ZIP can further be decompressed by 7-ZIP.

Current version of the 7-ZIP also doesn't support multivolume archives, the most of the SFX archives and encrypted files.

Command line syntax:

Contents | Commands | Switches

7ZIP <command> [<switch>...] <base_archive_name>[.zip] [<arguments>...]

<arguments> ::= <switch> | <wildcard> | <filename> | <list_file>

<switch>::= {'/'|'-'}<switch_characters>[<option>]

<list_file> ::= '@'<filename>

Expressions in square brackets (between '[' and ']') are optional.

Expressions in curly braces (between '{' and '}') are required.

Expression

expression1 | expression2 | ... | expressionN

means that any (but only one) from these expressions must be specified.

Commands and switches can be entered in upper or lower case.

Command is the first non-switch argument.

The "base_archive_name" must be the first filename on the command line after the command.

The switches and other filenames can be in any order.

Wildcards or filenames with spaces must be quoted:

"c:\Program files\*"

c:\"Program files"\*

Switch options can be combined to save command line length. However, some switch options take optional string arguments and therefore, must be the last option in a combined argument token string because 7-ZIP accepts the rest of the argument token as the optional argument.

7-ZIP uses wild name matching similar to Windows 95:

Examples:

"*.txt"

means all files with an extension of ".txt"

"?a*"

means all files with a second character of "a"

"*1*"

means all names that contains character "1"

"*.*.*"

means all names that contain two "." characters

The default wildcard "*" will be used if there is no filename/wildcard in command line.

Restrictions for wildcards and filenames for archiving files:

Examples:

Dir1\*.cpp

OK

c:\Dir1\*.cpp

ILLEGAL: path contains disk name

Dir1\Dir2\g?.txt

OK

Dir1\D?r2\file1.txt

ILLEGAL: there is a wildcard char in non last part

These restrictions do not act to filenames and directory names used not as archiving files.

List file

You can supply one or more filenames or wildcards for special list files (files containing lists of files). The filenames in such list file must be separated by space, tab or new line symbol(s). Wildcards or filenames with spaces must be quoted.

Multiple list files are supported.

For example, if contents of file "listfile.txt" is the following:

"My programs\*.cpp"

Src\*.cpp

then command

7ZIP a archive @listfile.txt

adds to archive "archive.zip" all "*.cpp" files from directories "My programs" and "Src"

Commands:

Contents | Command line syntax | Switches

ID

Description

Related Switches

a

Add

-i, -m, -mx, -r, -u, -w, -x

d

Delete

-i, -m, -mx, -r, -u, -w, -x

e

Extarct

-i, -o, -r, -x, -y

l

List

-i, -r, -x

t

Test

-i, -r, -x

u

Update

-i, -m, -mx, -r, -u, -w, -x

x

Extract with full paths

-i, -o, -r, -x, -y

a: Add files to archive

Contents | Command line syntax | Commands | Switches

This command allows to add files to archive.

Examples:

7ZIP a archive subdir\*

archives all files in directory "subdir".

7ZIP a archive "c:\Program files\*" -r

archives all files in directory "Program files" and subdirectories.

See also: d, u, -u

Related switches: -i, -m, -mx, -r, -u, -w, -x

d: Delete files from archive

Contents | Command line syntax | Commands | Switches

This command allows you to delete files from the archive. These deleted files are physically removed from the archive.

Example:

7ZIP d archive *.bak

See also: a, u, -u

Related switches: -i, -m, -mx, -r, -u, -w, -x

e: Extract files from archive

Contents | Command line syntax | Commands | Switches

This command will extract one or more files from the archive to the current directory or to the output directory if specified. 7-ZIP will prompt the user before overwriting existing files unless the user specifies the "-y" switch. If the user gives a "no" answer, 7-ZIP will prompt must file be extracted to other filename. Then a "no" answer skips file and "yes" prompts for new filename.

7-ZIP accepts the following responses:

Abbreviated responses such as "y", "n", "a", "s" and "q" are allowed.

Example:

7ZIP e archive -oc:\soft *.cpp

extracts all files ending in ".cpp" to subdirectory "c:\soft".

See also: x

Related switches: -i, -o, -r, -x, -y

l: List contents of archive

Contents | Command line syntax | Commands | Switches

Format:

l [a | t] [f]

List contents of archive.

a

List with Additional fields

t

List with all fields, including technical

f

List with pathnames

Example:

7ZIP lf archive *.txt

lists all "txt" files with full pathnames.

Related switches: -i, -r, -x

t: Test integrity of archive

Contents | Command line syntax | Commands | Switches

Test archive files. This command performs a dummy file extraction, writing nothing to the output stream, in order to validate the specified file(s). 7-ZIP uses a 32 bit CRC to validate the contents of the files.

Example:

7ZIP t archive *.doc

tests all files ending in ".doc".

Related switches: -i, -r, -x

u: Update files to archive

Contents | Command line syntax | Commands | Switches

Update older files in the archive and add files that are new to the archive.

Example:

7ZIP u archive *.doc

See also: a, d, -u

Related switches: -i, -m, -mx, -r, -u, -w, -x

x: eXtract files with full pathname

Contents | Command line syntax | Commands | Switches

This command extracts one or more files from the archive to their full paths in the current directory or to the output directory if specified.

Example:

7ZIP x archive -oc:\soft -r *.cpp

extracts all files ending in ".cpp" from all archive subdirectories to directory "c:\soft".

See also: e

Related switches: -i, -o, -r, -x, -y

Switches:

Contents | Command line syntax | Commands

ID

Description

Related commands

-i

Include filenames

a, d, e, l, t, u, x

-m

Set Method

a, d, u

-mx

MaXimize compression

a, d, u

-o

Set Output directory

e, x

-r

Recurse subdirectories

a, d, e, l, t, u, x

-u

Update options

a, d, u

-w

Assign Work directory

a, d, u

-x

Exclude filenames

a, d, e, l, t, u, x

-y

Assume Yes on all queries

e, x

 

-i: Include filenames

Contents | Command line syntax | Commands | Switches

Format:

-i [r [- | 0] ] {@ listfile | ! wildcard}

This switch specifies additional include filenames and wildcards.

r [- | 0]

Specifies how wildcards and file names specified in this switch must be used. If this option is not assigned then global value, assigned by -r switch will be used. For more details see specification of -r switch

@listfile

Specifies name of list file. See List file description

!wildcard

Specifies wildcard or filename

Multiple include switches are supported.

Example:

7ZIP a src *.txt -ir!DIR1\*.cpp

adds all "*.txt" files from current directory and all "*.cpp" files from directory "DIR1" and from all it's subdirectories.

See also: -r, -x

Related commands: a, d, e, l, t, u, x

-m: set compression Method

Contents | Command line syntax | Commands | Switches

Format:

-m <method_id>

<method_id> ::= 0 | 8

This switch specifies archiving method.

-m0

"Store" method. Files will be copied to archive without compression. Archiving with "-m0" is faster then with "-m8"

-m8

"Normal" method. Files will be compressed. This option is set by default

Examples:

7ZIP a archive *.jpg -m0

adds all "*.jpg" files to archive without compression.

7ZIP a arch *.exe *.dll -m8

adds all "*.exe" and "*.dll" files to archive using normal compression method.

Related commands: a, d, u

-mx: maXimize compression

Contents | Command line syntax | Commands | Switches

Format:

-mx

This switch sets the best compression method. It requires additional 9 MB of RAM and works about twice slower.

Related commands: a, d, u

-o: set Output directory

Contents | Command line syntax | Commands | Switches

Format:

-o dir_path

This switch specifies destination directory where files are to be extracted.

dir_path

Specifies the destination directory path. It's not required path end with a backslash.

This switch works only with extraction commands.

Example:

7ZIP e archive dir1\a.doc -oc:\Docs

extracts file "dir1\a.doc" from archive to "c:\Docs\a.doc"

Related commands: e, x

-r: Recurse subdirectories

Contents | Command line syntax | Commands | Switches

Format:

-r [- | 0]

This switch specifies method of treating wildcards and filenames assigned in command line.

-r

Enable recurse subdirectories. This option is default for all commands that matches files only within archive: e, l, t, x

-r-

Disable recurse subdirectories. This option is default for all commands that can scan files on disk: a, d, u

-r0

Enable recurse subdirectories only for wildcard names.

Examples:

7ZIP l archive -r- *.doc

lists all "*.doc" files in archive that belong root archive directory.

7ZIP a archive -r src\*.cpp src\*.h

adds all "*.cpp" and "*.h" files from directory "src" and all it's subdirectories.

See also: -i, -x

Related commands: a, d, e, l, t, u, x

-u: Update options

Contents | Command line syntax | Commands | Switches

Format:

-u [-] <actions> [! new_archive_name]

<action_set> ::= <state_action>...

<state_action> ::= <state_type> <action_type>

<state_type> ::= p | q | r | x | y | z

<action_type> ::= 0 | 1 | 2

This switch specifies how update files in archive and (or) create new archives.

-

Disable any updates in base archive.

! new_archive_name

Specifies path of the new archive, which must be created. All other options in this switch will refer to this new archive.

If not assigned, then all other options in this switch will refer to base archive of command

Term "base archive" means archive assigned by "base_archive_name" string in command line. See Command line syntax

Description of <state_type>:

For each unique filename there are 6 variants of state:

<state_type>

State condition

Disk

Archive

p

File exists in archive, but isn't wildcarded by archive command.

 

Exists, but isn't wildcarded

q

File exists in archive but doesn't exist on disk.

Not exists

Exists

r

File doesn't exist in archive but exists on disk.

Exists

Not exists

x

File in archive is newer than file with same name on disk.

Older

Newer

y

File in archive is older than file with same name on disk.

Newer

Older

z

File in archive is same as file with same name on disk.

Same

Same

 

Description of <action_type>:

For each of the <state_type> you can specify action what do you wish:

<action_type>

Description

0

Ignore file (don't create item in new archive for this file)

1

Copy file (copy from old archive to new)

2

Compress (compress file from disk to new archive)

 

Any update command (a, d, u) can be assigned in these terms:

 

p

q

r

x

y

z

Disk

any

Not exists

Exists

Older

Newer

Same

Archive

Exists, not wildcarded

Exists

 

Newer

Older

Same

             

a

Copy

         

d

Copy

Copy

Com

Com

Com

Com

u

Copy

Copy

Com

Copy

Com

Copy

"Empty" cell means 0 (Ignore).

"Copy" cell means 1 (Copy from base archive).

"Com" cell means 2 (Compress from disk).

If you don't specify "!newArchiveName", then all options will refer to main archive (archive assigned in command line after command).

If you specify "!newArchiveName", then 7-ZIP also will create a new archive with specified name. 7-ZIP can create any number of new archive during one operation.

By default for each new archive <action_set> is set as action set of main command (there are 3 different action sets for commands: a, d, u). You can overload any. <state_action>

Example:

7ZIP u exist_archive.zip -u- -usp0q0x2z0!update.zip *.cpp

creates new archive "update.zip" and writes to this archive all "*.cpp" files from current directory that differs from files in archive "exist_archive.zip". Archive "exist_archive" will not be changed.

Related commands: a, d, u

-w: assign Work directory

Contents | Command line syntax | Commands | Switches

Format:

-w [<path>]

This switch specifies working directory for temporary base archive. By default, 7-ZIP builds a new base archive file in the same directory as the old base archive file. By specifying the "-w" switch, you can specify the working directory where the temporary base archive file will be built. After the temporary base archive file is built, it is copied over the original archive and deleted. If <path> is not assigned, then 7-ZIP will use Windows temporary directory.

Example:

7ZIP a archive *.cpp -wc:\temp

Related commands: a, d, u

-x: Exclude filenames

Contents | Command line syntax | Commands | Switches

Format:

-x [r [- | 0] ] {@ listfile | ! wildcard}

This switch specifies what filenames or (and) wildcards must be excluded from operation.

For full option description of this switch see -i Include switch description.

-i[r[-|0]]@listfile|!wildcard

Multiple exclude switches are supported.

Example:

7ZIP a src *.txt -x!temp.*

adds all "*.txt", except files with "temp" name, to archive "src.zip".

See also: -i, -r

Related commands: a, d, e, l, t, u, x

-y: assume Yes on all queries

Contents | Command line syntax | Commands | Switches

Format:

-y

This switch disables most of the normal user queries during 7-ZIP execution. You can use this switch to suppress overwrite queries in the "e" and "x" commands.

Example:

7ZIP x src -y

extracts all files from archive "src.zip". All overwrite queries will be suppressed and files on disk with same filenames as in archive will be overwritten.

Related commands: e, x

FAR support

Contents

The "FAR Manager" is a very good file manager. It facilitates a large number of operations with files, folders and archives under Windows 95 and Windows NT operating systems. It works in text mode. You can download "FAR Manager" from sites:

http://www.creabel.com/softronic

http://www.rarsoft.com

If you want tune "FAR Manager" for 7-ZIP supporting you must

Since current version of the 7-ZIP can't work with some of the ZIP archives created by other ZIP utilities (see Zip format compatibility part of this document) then you can use some other ZIP utility for all operations except "Adding".

If you already have other ZIP utility used by FAR, then I recommend you register only file "far7zip.reg" and do not register "far7zip2.reg". If you have no other ZIP utility, then you should register file "far7zip2.reg".

By registering file "far7zip2.reg" you make FAR use 7-ZIP program for the following operations:

Note: current version of the 7-ZIP doesn't support "Move files to archive" operation.

If you want refuse 7-ZIP supporting in "FAR Manager" after registration of file "far7zip.reg" or "far7zip2.reg" then just remove lines that contain 7-ZIP program name from registry folder:

[HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\ZIP]

Final comments:

Contents

Please, don't trust this program for 100%. It's only the beta version, and I'm afraid that it can have some bugs.

I recommend you to test each archive made by this program after compression. The best way is to test each archive by other ZIP utility.

Please, If you will disclose any bugs in program then give me to know about it.

The official page of the 7-ZIP can be accessed at:

http://www.geocities.com/SiliconValley/Lakes/9584/7zip/index.html

You can find my other (non-compatible with ZIP) compression programs at:

http://www.geocities.com/SiliconValley/Lakes/9584/index.html

 

You may freely send your comments and suggestions to Igor Pavlov, the author of the 7-ZIP:

E-mail: igorp@geocities.com

WWW: http://www.geocities.com/SiliconValley/Lakes/9584/index.html

 

 

 

Igor Pavlov

 

End of document