ZipArchive.Extract(String) Method
SECURITY-RELATED CONSIDERATIONS
Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.
Extracts all archive items as files into the specified directory.
Namespace: DevExpress.Compression
Assembly: DevExpress.Docs.v25.2.dll
NuGet Package: DevExpress.Document.Processor
Declaration
Parameters
| Name | Type | Description |
|---|---|---|
| path | String | A string that is the path to the directory to which the files are extracted. |
Remarks
If the archive contains directories, the directory structure will be recreated in the specified directory. The ZipItem.Name property value becomes the file name of the extracted file.
This example illustrates how to load the zip file and extract it to the specified directory. If the target directory is not specified, the current directory is the target.
using DevExpress.Compression;
public void UnzipArchive() {
string pathToZipArchive = "Documents\\Example.zip";
string pathToExtract = "Documents\\!Extracted";
using (ZipArchive archive = ZipArchive.Read(pathToZipArchive)) {
foreach (ZipItem item in archive) {
item.Extract(pathToExtract);
}
}
}