Ionic Zip Library v1.9.1.6
Extract Method (baseDirectory, extractExistingFile)
Extract the entry to the filesystem, starting at the specified base
directory, and using the specified behavior when extraction would
overwrite an existing file.
Declaration Syntax
C# | Visual Basic | Visual C++ |
public void Extract( string baseDirectory, ExtractExistingFileAction extractExistingFile )
Public Sub Extract ( _ baseDirectory As String, _ extractExistingFile As ExtractExistingFileAction _ )
public: void Extract( String^ baseDirectory, ExtractExistingFileAction extractExistingFile )
Parameters
- baseDirectory (String)
- the pathname of the base directory
- extractExistingFile (ExtractExistingFileAction)
- The action to take if extraction would overwrite an existing file.
Remarks
See the remarks on the LastModified property, for some details about how the last modified time of the created file is set.
Examples
CopyC#
String sZipPath = "Airborne.zip"; String sFilePath = "Readme.txt"; String sRootFolder = "Digado"; using (ZipFile zip = ZipFile.Read(sZipPath)) { if (zip.EntryFileNames.Contains(sFilePath)) { // use the string indexer on the zip file zip[sFileName].Extract(sRootFolder, ExtractExistingFileAction.OverwriteSilently); } }
CopyVB.NET
Dim sZipPath as String = "Airborne.zip" Dim sFilePath As String = "Readme.txt" Dim sRootFolder As String = "Digado" Using zip As ZipFile = ZipFile.Read(sZipPath) If zip.EntryFileNames.Contains(sFilePath) ' use the string indexer on the zip file zip(sFilePath).Extract(sRootFolder, _ ExtractExistingFileAction.OverwriteSilently) End If End Using