Ionic Zip Library v1.9.1.6
AddFiles Method (fileNames, preserveDirHierarchy, directoryPathInArchive)
ReferenceIonic.ZipZipFileAddFiles(IEnumerable<(Of <<'(String>)>>), Boolean, String)
Adds a set of files to the ZipFile, using the specified directory path in the archive, and preserving the full directory structure in the filenames.
Declaration Syntax
C#Visual BasicVisual C++
public void AddFiles(
	IEnumerable<string> fileNames,
	bool preserveDirHierarchy,
	string directoryPathInArchive
Public Sub AddFiles ( _
	fileNames As IEnumerable(Of String), _
	preserveDirHierarchy As Boolean, _
	directoryPathInArchive As String _
void AddFiles(
	IEnumerable<String^>^ fileNames, 
	bool preserveDirHierarchy, 
	String^ directoryPathInArchive
fileNames (IEnumerable<(Of <(<'String>)>)>)
The names of the files to add. Each string should refer to a file in the filesystem. The name of the file may be a relative path or a fully-qualified path.
preserveDirHierarchy (Boolean)
whether the entries in the zip archive will reflect the directory hierarchy that is present in the various filenames. For example, if fileNames includes two paths, \Animalia\Chordata\Mammalia\Info.txt and \Plantae\Magnoliophyta\Dicotyledon\Info.txt, then calling this method with preserveDirHierarchy = false will result in an exception because of a duplicate entry name, while calling this method with preserveDirHierarchy = true will result in the full direcory paths being included in the entries added to the ZipFile.
directoryPathInArchive (String)
Specifies a directory path to use to override any path in the file name. This path may, or may not, correspond to a real directory in the current filesystem. If the files within the zip are later extracted, this is the path used for the extracted file. Passing null (Nothing in VB) will use the path on each of the fileNames, if any. Passing the empty string ("") will insert the item at the root path within the archive.

If preserveDirHierarchy is true, any directory structure present in the filenames contained in the list is preserved in the archive. On the other hand, if preserveDirHierarchy is false, any directory structure that may be present in the filenames contained in the list is "flattened" in the archive; Each file in the list is added to the archive in the specified top-level directory.

For ZipFile properties including Encryption, Password, SetCompression, ProvisionalAlternateEncoding, ExtractExistingFile, ZipErrorAction, and CompressionLevel, their respective values at the time of this call will be applied to each ZipEntry added.

See Also

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: (