-x (Exclude filenames) switch

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

Multiple exclude switches are supported.

Syntax

-xtd
-x[<recurse_type>][<mark_type>][<wildcard_type>]<file_ref>

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

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

-xtd : to exclude directory metadata records from processing. But it still can process all files in any directory and in subdirectories. If switch -xtd is specified, 7-zip doesn't process records that represent metadata properties of directory itself: name, timestamps and attributes of directory. So the archive created with -xtd will contain only records for files. But these files still can reside in different directories and subdirectories.

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)