Private Shared rootPath As String = "C:\temp" Private Shared offset As Integer = rootPath.Length + 1 Protected Sub btnCompress_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCompress.Click Dim crc As New Crc32() Dim s As New ZipOutputStream(File.Create("C:\backup.zip")) s.SetLevel(5) zipDir(rootPath, crc, s) s.Finish() s.Close() End Sub Public Shared Sub zipDir(ByVal dir As String, ByRef crc As Crc32, ByRef s As ZipOutputStream) Dim filenames As String() = Directory.GetFiles(dir) For Each f As String In filenames If (f.Substring(f.Length - 4) = ".zip") Then Continue For End If Dim fs As FileStream = File.OpenRead(f) Dim buffer(fs.Length) As Byte fs.Read(buffer, 0, buffer.Length) Dim entry As ZipEntry = New ZipEntry(f.Substring(offset)) entry.DateTime = DateTime.Now entry.Size = fs.Length fs.Close() crc.Reset() crc.Update(buffer) entry.Crc = crc.Value s.PutNextEntry(entry) s.Write(buffer, 0, buffer.Length) Next Dim dirnames As String() = Directory.GetDirectories(dir) For Each d As String In dirnames zipDir(d, crc, s) Next End Sub