> Private Sub recurse(ByVal dir As String, ByRef strmZipOutputStream As ZipOutputStream) > Dim Add, Current As Integer > Dim ChildDirs, childfiles As String() > Dim Cdir, cfile As String > > > ChildDirs = Directory.GetDirectories(dir) > > For Each Cdir In ChildDirs > childfiles = Directory.GetFiles(Cdir, ds.Tables("fileconfig").Rows(0).Item("filemask")) > Dim objCrc32 As New Crc32 > Me.ProgressBar1.Minimum = 0 > Me.ProgressBar1.Step = 1 > Me.ProgressBar1.Maximum = childfiles.Length > ' > For Each cfile In childfiles > > Me.lblprogress.Text = "Compressing " & cfile > Me.lblprogress.Refresh() > Dim strmFile As FileStream = File.OpenRead(cfile) > Dim abyBuffer(strmFile.Length - 1) As Byte > strmFile.Read(abyBuffer, 0, abyBuffer.Length) > Dim objZipEntry As ZipEntry = New ZipEntry(cfile) > objZipEntry.DateTime = DateTime.Now > objZipEntry.Size = strmFile.Length > strmFile.Close() > objCrc32.Reset() > objCrc32.Update(abyBuffer) > objZipEntry.Crc = objCrc32.Value > strmZipOutputStream.PutNextEntry(objZipEntry) > strmZipOutputStream.Write(abyBuffer, 0, abyBuffer.Length) > Me.ProgressBar1.PerformStep() > > Next > Me.ProgressBar1.Value = 0 > 'Keep going > recurse(Cdir, strmZipOutputStream) > > Next > > End Function >