Zip & UnZip in vb.net

Monday, May 12, 2008


Module UnZipAndZip
Public Sub WebZip(ByVal FilePath As String, ByVal CompressedFilePath As String)
Dim FL As Scripting.File
Dim FSO As New Scripting.FileSystemObject()
Dim FPstr, CMPstr As String
Dim TS As Scripting.TextStream
FL = FSO.GetFile(FilePath)
FPstr = FL.ShortPath
FL = Nothing
If System.IO.File.Exists(CompressedFilePath) = False Then
TS = FSO.CreateTextFile(CompressedFilePath, True)
FL = FSO.GetFile(CompressedFilePath)
CMPstr = FL.ShortPath
TS.Close()
FL = Nothing
System.IO.File.Delete(CompressedFilePath)
FSO = Nothing
Else
FL = FSO.GetFile(CompressedFilePath)
CMPstr = FL.ShortPath
FL = Nothing
FSO = Nothing
End If
Microsoft.VisualBasic.Interaction.Shell(Application.StartupPath & "\DB1.Exe -a " & CMPstr & " " & FPstr, AppWinStyle.Hide, True)
End Sub
Public Sub WebUnZip(ByVal CompressedFilePath As String, ByVal FilePath As String)
Dim FL As Scripting.File
Dim Fldr As Scripting.Folder
Dim FSO As New Scripting.FileSystemObject()
Dim FPstr, CMPstr As String
Dim TS As Scripting.TextStream
FL = FSO.GetFile(CompressedFilePath)
CMPstr = FL.ShortPath
FL = Nothing
Fldr = FSO.GetFolder(FilePath)
FPstr = Fldr.ShortPath
FSO = Nothing
Microsoft.VisualBasic.Interaction.Shell(Application.StartupPath & "\DB11.exe " & CMPstr & " " & FPstr, AppWinStyle.Hide, True)
End Sub
End Module

0 comments

Post a Comment