wonder_gal
Active member
- Joined
- Jun 5, 2006
- Messages
- 34
- Programming Experience
- 1-3
Hi, I've coded a function to uncompress compressed file, but i received this error, "The filename, directory name, or volume label syntax is incorrect." Can someone kindly point out to me what's wrong here? Here's my coding, and I've highlighted the line which cause this error to pop up. Thanks.
VB.NET:
Dim fileName As String = Path.GetFullPath("..\MK_DN\Photos.zip")
Dim destPath As String = Path.GetFullPath("..\MK_DN\UNZIPPED")
If Not Directory.Exists(destPath) Then
Directory.CreateDirectory(destPath)
Else
For Each s As String In Directory.GetFiles(destPath)
File.Delete(s)
Next
End If
Dim inStream As New ZipInputStream(File.OpenRead(fileName))
Dim outStream As FileStream
Dim entry As ZipEntry
Dim buff(2047) As Byte
Dim bytes As Integer
Do While True
entry = inStream.GetNextEntry()
If entry Is Nothing Then
Exit Do
End If
[B]outStream = File.Create(destPath + entry.Name)[/B]
Do While True
bytes = inStream.Read(buff, 0, buff.Length)
If bytes = 0 Then
Exit Do
End If
outStream.Write(buff, 0, bytes)
Loop
outStream.Close()
Loop
inStream.Close()
MsgBox("Congratulations, your file have been unzipped!", MsgBoxStyle.Information, "Sucessfully Unzipped")