roddios
asked on
SharpZipLib I'm getting an empty folder as a result when compressing a folder using the SharpZipLib library
I pretty much uses the code provided in the example to create a zip file, but the output file is empty and has no content. I'm using .NET 1.1, Windows XP SP2 and Visual Studio 2003.
I have also compiled the sample project that came with the library and again the output zip file is empty.
Has anyone run into this problem and knows what to do to fix it
Thanks
Rod
Dim dir As String
dir = "E:\wwwroot\test"
Dim astrFileNames() As String = Directory.GetFiles(dir)
Dim targetName As String = "E:\wwwroot\backup\test.zi p"
Dim s As Zip.ZipOutputStream
Dim objZipEntry As Zip.ZipEntry
s = New Zip.ZipOutputStream(File.C reate(targ etName))
REM Compression Level: 0-9
REM 0: no(Compression)
REM 9: maximum compression
s.SetLevel(5)
Dim strFile As String
For Each strFile In astrFileNames
Dim strmFile As FileStream = File.OpenRead(strFile)
Dim abyBuffer(strmFile.Length - 1) As Byte
strmFile.Read(abyBuffer, 0, abyBuffer.Length)
objZipEntry = New Zip.ZipEntry(strFile)
objZipEntry.DateTime = DateTime.Now
objZipEntry.Size = strmFile.Length
s.PutNextEntry(objZipEntry )
s.Write(abyBuffer, 0, abyBuffer.Length)
strmFile.Close()
Next
s.Finish()
s.Close()
I have also compiled the sample project that came with the library and again the output zip file is empty.
Has anyone run into this problem and knows what to do to fix it
Thanks
Rod
Dim dir As String
dir = "E:\wwwroot\test"
Dim astrFileNames() As String = Directory.GetFiles(dir)
Dim targetName As String = "E:\wwwroot\backup\test.zi
Dim s As Zip.ZipOutputStream
Dim objZipEntry As Zip.ZipEntry
s = New Zip.ZipOutputStream(File.C
REM Compression Level: 0-9
REM 0: no(Compression)
REM 9: maximum compression
s.SetLevel(5)
Dim strFile As String
For Each strFile In astrFileNames
Dim strmFile As FileStream = File.OpenRead(strFile)
Dim abyBuffer(strmFile.Length - 1) As Byte
strmFile.Read(abyBuffer, 0, abyBuffer.Length)
objZipEntry = New Zip.ZipEntry(strFile)
objZipEntry.DateTime = DateTime.Now
objZipEntry.Size = strmFile.Length
s.PutNextEntry(objZipEntry
s.Write(abyBuffer, 0, abyBuffer.Length)
strmFile.Close()
Next
s.Finish()
s.Close()
ASKER
Yes it does
as the matter of fact i don't think it's a problem with the code.
I have downloaded the evaluation copy of winzip and i can unzip my folder and see all the files... weirrrrrrrrd but the version I was using was the free one that comes originally with Windows and was showing an empty folder
as the matter of fact i don't think it's a problem with the code.
I have downloaded the evaluation copy of winzip and i can unzip my folder and see all the files... weirrrrrrrrd but the version I was using was the free one that comes originally with Windows and was showing an empty folder
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for your time anyway
cheers
Rod
cheers
Rod
Bob