-i (Include filenames) switch

Specifies additional include filenames and wildcards.

Multiple include switches are supported.

Syntax

-i[<recurse_type>][<mark_type>][<wildcard_type>]<file_ref>

<recurse_type> ::= r[- | 0]
<mark_type> ::= m[- | 2]
<wildcard_type> ::= w[-]
<file_ref> ::= @{listfile} | !{wildcard}

Parameters

<recurse_type>
<recurse_type> ::= r[- | 0]

Specifies how wildcards and file names in this switch must be used for recursive search of files and directories. If this option is not given, then the global value will be used, that can be changed by the -r (Recurse) switch.

Note: The "r" option rules affect only searching phase of item (file or directory) with specified names. And if the directory is found for processing, 7-Zip will process also all subdirectories and all files of that directory and files of subdirectories, even if the search recursion is switched off with "r-" option. See -r (Recurse) switch description for more details.

Option Description
r Enable recurse subdirectories for item search.
r- Disable recurse subdirectories for item search. This option is default for all commands, if was not changed in global level.
r0 Enable recurse subdirectories for item search only for wildcard names.
<mark_type>
<mark_type> ::= m[- | 2]

Enables the mode that requires directory path separator mark (character) at the end of path for directory items. The path separator mark (character) is backslash (\) in Windows or slash (/) in Linux. So this switch option allows to exclude directories from processing, if path separator mark is not specified at the end of path of wildcard or name. If this option is not given, then the global mode is used, that can be changed with -spm switch.

Option Description
m allow directories only with path separator mark at the end.
m2 allow directories with path separator mark and directories for non-wildcard paths.
m- allow directories for any path. This option is default, if was not changed in global level.
<wildcard_type>
<wildcard_type> ::= w[-]

Enables or disables wildcard matching mode for names in this switch. If this option is not given, then the global wildcard mode is used. By default global wildcard mode is enabled. Global wildcard mode can be disabled by global -spd switch.

Option Description
w Enables wildcard mode. It's default mode, if was not changed in global level.
w- Disables wildcard mode.
<file_ref>

Specifies filenames and wildcards, or a list file, for files to be processed.

<file_ref> ::= @{listfile} | !{wildcard}
Option Description
{listfile} Specifies name of list file. See List file description.
{wildcard} Specifies wildcard or filename.

Examples

7z a -tzip src.zip *.txt -ir!DIR1\*.cpp

adds to src.zip archive all *.txt files only from current directory and all *.cpp files from directory DIR1 and from all it's subdirectories.

Commands that can be used with this switch

a (Add), d (Delete), e (Extract), h (Hash), l (List), rn (Rename), t (Test), u (Update), x (Extract with full paths)

See also

Switches: -r (Recurse), -m (Path Separator Mark), -x (Exclude)