Deletes one or more files from an existing archive.
def delete(filenames: str) -> None: ...
on_delete deletes one or more files from an existing archive, without reprocessing the compressed data. The archive will be opened immediately, and the file(s) will immediately be removed permanently from the archive.
The list of filenames should be specified exactly as when calling extract:
Filenames 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 affected; subdirectories will be recursed into if recurse_subdirectories is true. If no path is specified but wildcards are, matching files in all directories will be affected. If a single filename without a path is specified, it must correspond exactly to the appropriate value of file_compressed_name.
Directories should end with a slash ("/"). If a directory is specified, all files and subdirectories in the specified directory will be affected.
A pipe character ("|") should be used to separate multiple file or directory names. Alternatively, the method may be invoked repeatedly.
The excluded_files property may be used to further limit the files to be deleted. When on_delete is used to delete a directory or match wildcards, each file to be deleted is first compared against excluded_files, and any files marked as excluded will not be deleted. When on_delete is used to delete a single file, the value of excluded_files will be ignored.
When the method is invoked, the scan method will first be invoked, if it has not been invoked already. Note that if include_files has been invoked, or if the values of file_compressed_name and file_decompressed_name for each file in the files collection have been set, this information will be reset by the call to scan.
When deleting multiple files, the class will operate most efficiently if all filenames are passed to on_delete in a single invocation of the method. Invoking on_delete repeatedly on large archives is not recommended.
Invoking on_delete will only remove files from archive_file; it will not delete the files from the disk.
ZipControl.ArchiveFile = "c:\\test.zip" ZipControl.Delete("default_readme.txt"); ZipControl.Append("\\mydir\\my_readme.txt", "my_readme.txt")