This project is read-only.

Using ExtractSelectedEntries() to extract certain files

Nov 10, 2009 at 9:16 PM
Edited Nov 10, 2009 at 9:17 PM

I have a zip file that contains a file called 'MyDatabase.mdb'.  The path stored in the zip file to this file is "users\public\myapp\".  I am trying to extract this file using ExtractSelectedEntries to restore the file to its original location.  I can extract it using ExtractAll("MyDatabase.mdb", "c:\users\public\myapp\") which works fine.  However, I need the functionality of ExtractSelectedEntries so my simple test of that feature will become more complex later if I can get the simple test to work.  The problem is that I cannot get this method to extract the file.  Here is what I have tried:

 Using zip As Ionic.Zip.ZipFile = Ionic.Zip.ZipFile.Read(zipFileName

zip.ExtractSelectedEntries("name = 'MyDatabase.mdb'", "users\public\myapp\", "c:\", ExtractExistingFileAction.OverwriteSilently)

End Using

 As I mentioned, this does not work, the zips internal path to the file "users\public\myapp\" was cut/paste directly from Winzip.  I tried the following variations:

zip.ExtractSelectedEntries("name = 'MyDatabase.mdb'", "\users\public\myapp\", "c:\", ExtractExistingFileAction.OverwriteSilently)


The last variation worked. Which means that the internal zip path specified in the second parameter cannot end with a backslash.  This is a bit inconsistent with other directory path specifications which do allow the path to end with a backslash. 



"name = 'MyDatabase.mdb'", "users\public\myapp", "c:\", ExtractExistingFileAction.OverwriteSilently)

Nov 11, 2009 at 10:38 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Nov 11, 2009 at 11:34 AM

Thanks Andy,

that is fixed in v1.8.4.28 .