IPWorks ZIP 2020 Python Edition

Questions / Feedback?

include_files Method

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


def include_files(filenames: str) -> None: ...


include_files 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 file_decompressed_name field, and without a pathname in the file_compressed_name 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 recurse_subdirectories is set to true. When recursing into subdirectories, relative path information will be stored in file_compressed_name field of the files collection.

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

Note that invoking include_files will not reset the class, or remove old values of file_compressed_name and file_decompressed_name. This may be done by first clearing the files collection.


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

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