Page 1 of 2

Zip extracter

Posted: Tue Feb 16, 2010 6:55 am
by Livengood
Hey guys i was woundering if anyone could make a tutorial on how to extract a files from a zip to a folder that you choose
if would be very useful :D

Re: Zip extracter

Posted: Tue Feb 16, 2010 7:37 am
by hungryhounduk
Hey guys i was woundering if anyone could make a tutorial on how to extract a files from a zip to a folder that you choose if would be very useful
Hi Livengood
Someone a while back posted the same queastion, have a look here in this section as i'm sure there is a post answering that......hope this helps

regards

Chris

ps: welcome to codenstuff cooll;

Re: Zip extracter

Posted: Tue Feb 16, 2010 7:39 am
by Livengood
Thanks :)

Re: Zip extracter

Posted: Tue Feb 16, 2010 7:59 am
by Livengood
i found it,
http://dotnetzip.codeplex.com/
but i keep getting an error :(

Re: Zip extracter

Posted: Tue Feb 16, 2010 8:10 am
by hungryhounduk
Hi Livengood
mm i have not tried that out myself, so i dont know what the error is, but i'm sure someone will come here and point you in the right direction and help you with the problem.

Chris

Re: Zip extracter

Posted: Wed Feb 17, 2010 12:01 am
by Livengood
I get a error with the line that has ZipFile in it

Re: Zip extracter

Posted: Wed Feb 17, 2010 12:40 am
by CodenStuff
Hello,

Are you using this code:
Code: Select all
Dim ZipToUnpack As String = "C:\C1P3SML.zip"  'Name and location of your zip file
   Dim TargetDir As String = "C:\C1P3SML"  'Location and folder name to extract too
   Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)   
        Dim e As ZipEntry   
       ' here, we extract every entry, but we could extract    
       ' based on entry name, size, date, etc.   
       For Each e In zip1   
           e.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)   
       Next  
   End Using  

Re: Zip extracter

Posted: Wed Feb 17, 2010 1:39 am
by Livengood
yea i was trying to use that code, i keep getting a error

Code + Error spot :
Dim ZipToUnpack As String = "C:\C1P3SML.zip" 'Name and location of your zip file
Dim TargetDir As String = "C:\C1P3SML" 'Location and folder name to extract too
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
Dim e As ZipEntry
' here, we extract every entry, but we could extract
' based on entry name, size, date, etc.
For Each e In zip1
e.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
Next
End Using

Re: Zip extracter

Posted: Wed Feb 17, 2010 2:49 am
by CodenStuff
Hello,

When you download the DotNetZip library make sure you reference the "Ionic.Zip.dll" file by:

Clicking "Project" in the top menu and then click "Your application properties" > "References" then browser to the dll and click OK.

Then add this import to the top of your forms code:
Code: Select all
Imports Ionic.Zip
And use this for extracting zips:
Code: Select all
  Dim ZipToUnpack As String = "C:\C1P3SML.zip"  'Name and location of your zip file
        Dim TargetDir As String = "C:\C1P3SML"  'Location and folder name to extract too
        Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
            Dim we As ZipEntry
            For Each we In zip1
                we.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
            Next
        End Using
Happy coding cooll;

Re: Zip extracter

Posted: Thu Feb 18, 2010 1:07 am
by Livengood
Thank you :D
it worked