473,385 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

UNZIP File

Hi
Where can I find info on unzipping file with VB.NET. I need to unzip a winzip file with my application

Thanks
Jul 21 '05 #1
7 3324
The J# runtimes have that capability and otherwise check out
http://www.icsharpcode.net/OpenSourc...b/Default.aspx for a free
zipping utility.

Yves

"Chris" <an*******@discussions.microsoft.com> schreef in bericht
news:5B**********************************@microsof t.com...
Hi,
Where can I find info on unzipping file with VB.NET. I need to unzip a winzip file with my application.
Thanks

Jul 21 '05 #2
Hi
I have th foll code

If (False = rdCompress.Checked) The
' Decompression of single-file archiv
Dim fsBZ2Archive As FileStream, fsOutput As FileStrea
Dim strOutputFilename As Strin

fsBZ2Archive = File.OpenRead(txtFileName.Text
strOutputFilename = Path.GetDirectoryName(txtFileName.Text) &
Path.GetFileNameWithoutExtension(txtFileName.Text

fsOutput = File.Create(strOutputFilename

BZip2.Decompress(fsBZ2Archive, fsOutput

fsBZ2Archive.Close(
fsOutput.Flush(
fsOutput.Close(
Els
'Compression of single-file archiv
Dim fsInputFile As FileStream, fsBZ2Archive As FileStrea
fsInputFile = File.OpenRead(txtFileName.Text
fsBZ2Archive = File.Create(txtFileName.Text + ".zip") '<<<<<<<<<<<<<i change this from .BZ to .ZI

BZip2.Compress(fsInputFile, fsBZ2Archive, 4026

fsInputFile.Close(

---------------------------------------------------
The zip file is created but when I try to open it I get "File is not a valid archive" and ideas?
Jul 21 '05 #3
Chris <an*******@discussions.microsoft.com> wrote:
The zip file is created but when I try to open it I get "File is not
a valid archive" and ideas?


I don't believe that bzip2 is the same as zip.

See http://www.pobox.com/~skeet/csharp/faq/#zip though for a link to a
..NET zip library.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4
Jon
Thhats the same lib I downloaded but I can't seem to unzip a .zip file. Do you have any ideas?
Jul 21 '05 #5
Chris <an*******@discussions.microsoft.com> wrote:
Thhats the same lib I downloaded but I can't seem to unzip a .zip
file. Do you have any ideas?


Well, using ZipFile, ZipInputStream and ZipEntry seem to be a good bet
to me.

I've just written this code which unzips a file - but it doesn't do
anything about paths etc, so will fail on various zip files. It just
demonstrates the very basic ideas.

using System.IO;
using ICSharpCode.SharpZipLib.Zip;

public class Test
{
static void Main(string[] args)
{
foreach (string x in args)
{
Unzip (x);
}
}

static void Unzip (string zipName)
{
byte[] buffer = new byte[16384];
ZipFile zipFile = new ZipFile(zipName);
try
{
foreach (ZipEntry entry in zipFile)
{
Stream input = zipFile.GetInputStream(entry);
using (Stream output = File.Create(entry.Name))
{
int read;
while((read=input.Read(buffer,0,buffer.Length))>0)
{
output.Write(buffer, 0, read);
}
}
}
}
finally
{
zipFile.Close();
}
}
}
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #6
Chris <an*******@discussions.microsoft.com> wrote:
Thanks Guy! But I truely don't understand C#.


It should be fairly clear what method calls are involved though. The
only other thing you need to know is that a "using" construct calls
Dispose on what you create at the start of it.

There should certainly be enough information there for you to work out
how to use the library. (There should be enough in the documentation,
even - I hadn't used SharpZipLib at all before creating that test app,
and it only took a few minutes or so to write it.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #7
Cor
Hi Jon,

Chriss asked this question again in the language.vb group.

I have given hime the bottle opener with a lot of links to C#, VB
converters.

Cor
Jul 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Yogi_Bear_79 | last post by:
pardon my ignorance as I am a self-taught hobbyist programmer. I am curious after reading up on SharpZipLib. Can I embed a zipped txt file in my program? Then either read from within the zip...
1
by: Jean Christophe Avard | last post by:
Hi! Finally I figure out what was wrong... "objZipEntry.size = strmFile" I wasn't giving the right file length... But now, I have issue with the unzip function... I can't unzip it, the unzip function...
7
by: Chris | last post by:
Hi Where can I find info on unzipping file with VB.NET. I need to unzip a winzip file with my application Thanks
3
by: SDRoy | last post by:
Hello Can someone tell me how I can unzip a .zip file in C#. The zip file is already there and I just need to unzip..not zip and unzip. -- Thanks, SDRoy
4
by: DataSmash | last post by:
I need to unzip all zip file(s) in the current directory into their own subdirectories. The zip file name(s) always start with the string "usa" and end with ".zip". The code below will make the...
3
by: sdoty044 | last post by:
I am a true n00b... and I just using Python to complete some very small uneventful task, but need help with one last thing. Basically, this I what I am trying to do. make a temp directory...
5
by: =?Utf-8?B?anVsaW8=?= | last post by:
Hi, I write a program to unzip a Tar file generated on a Unix environment file using SharpZipLib, but returns a error "Header checksum is invalid" when execute the program. This error appears...
1
by: olddocks | last post by:
I want to upload a zip file and then extract/unzip it. I am accomplishing this with php exec command. I am calling unzip from php exec command within a php script and it is not extracting files. why?...
2
by: somsub | last post by:
Hi all, Here is my samle code use strict ; use warnings ; use IO::Uncompress::Unzip ; When I compiled this three lines of code in win32 I got error like below.
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.