IPWorks ZIP 2020 Node.js Edition

Questions / Feedback?

ExcludedFiles Property

A list of files to exclude.

Syntax

 sevenzip.getExcludedFiles([callback])
 sevenzip.setExcludedFiles( excludedFiles, [callback])

Default Value

""

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for the getExcludedFiles([callback]) method is defined as:

function(err, data){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'data' is the value returned by the method.

The callback for the setExcludedFiles([callback]) method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This property specifies files that should be excluded when Compress or Extract is invoked. When Compress is invoked, each value of FileDecompressedName in Files will be compared to ExcludedFiles, and each file will be excluded if the name matches. When Extract is called, each value of FileCompressedName 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 FileCompressedName or FileDecompressedName.

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 class for both compression and extraction. Failure to do so may result in I/O errors or unexpected results.

Data Type

String

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