Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Unzip One File from Zip without Overwriting Existing File
Locate and unzip a single file within a .zip, checking first to see if the file already exists before unzipping. ' This must be called once at the beginning of your program.
zip.UnlockComponent("Anything for 30-day trial")
' Open a zip archive.
Dim success As Boolean
success = zip.OpenZip("myZip.zip")
If (Not success) Then
MessageBox.Show(zip.LastErrorText)
Exit Sub
End If
' Find the file to be unzipped.
Dim entry As Chilkat.ZipEntry
' In this case, we know that test.txt is in a sub-directory within the zip.
entry = zip.FirstMatchingEntry("*/test.txt")
' Does test.txt already exist in our current working directory?
Dim f As New System.IO.FileInfo("test.txt")
If (Not f.Exists) Then
' Extract into the current working directory, regardless of the path
' in the Zip.
entry.ExtractInto(".")
End If
zip.CloseZip()
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.