ExcludedFiles Property

A list of files to exclude.

Syntax

public string ExcludedFiles { get; set; }
Public Property ExcludedFiles As String

Default Value

""

Remarks

This property specifies files that should be excluded when Compress or Extract is invoked. When Compress is invoked, each value of DecompressedName in Files will be compared to ExcludedFiles, and each file will be excluded if the name matches. When Extract is called, each value of CompressedName in Files matching the parameter to Extract will be compared to ExcludedFiles, and will be excluded if appropriate. Calling the ExtractAll method will ignore this property and extract all files in the archive.

This property may be set to one or more filenames or directory names. Files may be specified with or without a path, and with or without wildcards. If a path is specified, files in the indicated directory will be excluded; subdirectories will be recursed into if RecurseSubdirectories is true. If no path is specified but wildcards are, matching files in all directories will be excluded. If a single filename without a path is specified, it must correspond exactly to the appropriate value of CompressedName or DecompressedName.

Directories should end with a slash ("/" or "\", as appropriate.) If a directory is specified, all files and subdirectories in the specified directory will be excluded.

A pipe character ("|") should be used to separate multiple file or directory names.

The following examples illustrate the use of the property:

Example


ZipControl.ArchiveFile = "c:\test.zip"
ZipControl.IncludeFiles("c:\test\*")
ZipControl.ExcludedFiles = "*.tmp"
ZipControl.Compress()
Example


ZipControl.ArchiveFile = "c:\test.tar"
ZipControl.Scan()
ZipControl.ExcludedFiles = "*.bak | backup/"
ZipControl.ExtractToPath = "c:\temp"
ZipControl.Extract("*")
As per the examples, the property should be specified differently for compression and decompression. When invoking Compress, the format of ExcludedFiles should correspond to that of the local file system. When invoking Extract the format should correspond to standard (UNIX) format, and should not contain drive letters or backslashes.

You may exclude files based on their attributes as well: See the ExcludedAttributes configuration setting for more information.

If the property is set to the empty string, no files will be excluded. This property is never reset automatically, so be sure to reset it manually if using a single instance of the component for both compression and extraction. Failure to do so may result in I/O errors or unexpected results.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks ZIP 2020 .NET Edition - Version 20.0 [Build 8300]