IncludeFiles Method

Specifies that the indicated files should be added to the archive.

Syntax

public void IncludeFiles(string filenames);
Public Sub IncludeFiles(ByVal filenames As String)

Remarks

IncludeFiles may be used before Compress, to specify the files to be compressed. Invoking this method populates the Files collection accordingly.

Invoking the method does not create or alter the archive.

The argument should be a pipe ("|") -delimited sequence of one or more filenames. The filenames should be specified with paths if necessary, so that the files may be found on the local file system. The filenames will be stored as is in the DecompressedName field, and without a pathname in the CompressedName field of the Files collection.

Filenames may include the wildcards '?', '*', and '[ .. ]'. '?' will match any single character, and '*' will match an arbitrary sequence of characters. '[ .. ]' may be used to match any of the characters inside, or a range, such as '[a-z]'. A '\' can be used to escape wildcard characters.

If wildcards are specified, the file system will be scanned and all files matching the specified mask will be added. Moreover, subdirectories will be recursed into if RecurseSubdirectories is set to true. When recursing into subdirectories, relative path information will be stored in CompressedName field of the Files collection.

The ExcludedFiles may be used to limit the files to be compressed. This property is checked when Compress is invoked, rather than when IncludeFiles is invoked, so this property may be set before or after invoking IncludeFiles.

Note that invoking IncludeFiles will not reset the component, or remove old values of CompressedName and DecompressedName. This may be done by first clearing the Files collection.

Example


ZipControl.IncludeFiles("c:\test\* | c:\readme")
ZipControl.ExcludedFiles = "*.tmp"
ZipControl.Compress()

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