-x (Exclude filenames) switch

7-Zip 18

-x (Exclude filenames) switch

Specifies which filenames or wildcarded names must be excluded from the operation.

Multiple exclude switches are supported.

Syntax

-x[<recurse_type>]<file_ref>

<recurse_type> ::= r[- | 0]
<file_ref> ::= @{listfile} | !{wildcard}

See -i (Include) switch description for information about option parameters.

Examples

7z a -tzip archive.zip *.txt -x!temp.*

adds to the archive.zip all *.txt files, except temp.* files.

7z a archive.7z Folder1\ -xr!*.png

adds to the archive.7z all files from Folder1 and its subfolders, except *.png files.

Commands that can be used with this switch

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

See also

Switches: -r (Recurse), -i (Include)