Advertisement

03.04.2008 at 08:25AM PST, ID: 23213090
[x]
Attachment Details

Unable to delete zipped files

Asked by kosturdur in File Compression Utilities, Microsoft Visual Basic.Net, .Net Editors & IDEs

Tags: .Net

I'm using SharpZipLib (http://www.icsharpcode.net/OpenSource/SharpZipLib/) library to zip a file(System.IO.Compression is not suit able for files bigger that 4 GB and doesn't support x64).

 After zipping the file I couldn't delete it from windows explorer. I'm new to VB so I could miss something.

I'm sending;
Dim A As String = "C:\bck\backup.xxx"
Dim B As String = "C:\zip\backup.zip"
SimpleZip(A, B)

My code is below

Thanks,
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
Private Sub SimpleZip(ByVal strFileToZip As String, ByVal strZippedFile As String)
 
            Break up the new file location to extract the filename without the path
 
            Dim zipparts() As String = strFileToZip.Split("\"c)
 
            Dim zipfile As String = zipparts(zipparts.Length - 1)
 
            Dim strmZipOutputStream As ZipOutputStream
 
            strmZipOutputStream = New ZipOutputStream(File.Create(strZippedFile))
 
            'strmZipOutputStream.UseZip64 = UseZip64.On
 
            REM Compression Level: 0-9
 
            REM 0: no(Compression)
 
            REM 9: maximum compression
 
            strmZipOutputStream.SetLevel(5)
 
            Dim objZipEntry As ZipEntry = New ZipEntry(Path.GetFileName(strFileToZip))
 
            objZipEntry.DateTime = DateTime.Now
 
            'objZipEntry.Size = strmFile.Length
 
            strmZipOutputStream.PutNextEntry(objZipEntry)
 
            Dim strmFile As FileStream = File.OpenRead(strFileToZip)
 
            Dim abyBuffer(4096) As Byte
 
            Dim sourcebytes As Integer
            sourcebytes = strmFile.Read(abyBuffer, 0, abyBuffer.Length)
 
            While sourcebytes > 0
 
                strmZipOutputStream.Write(abyBuffer, 0, sourcebytes)
 
                sourcebytes = strmFile.Read(abyBuffer, 0, abyBuffer.Length)
            End While
 
 
            objZipEntry = Nothing
 
            strmZipOutputStream.CloseEntry()
 
            strmZipOutputStream.Finish()
 
            strmZipOutputStream.Close()
 
            strmZipOutputStream = Nothing
 
            strmFile.Close()
 
            strmFile = Nothing
        End Sub
[+][-]03.04.2008 at 09:05AM PST, ID: 21042787

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 09:08AM PST, ID: 21042823

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 09:28AM PST, ID: 21042983

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 09:38AM PST, ID: 21043080

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 10:25AM PST, ID: 21043525

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 11:13AM PST, ID: 21044027

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 11:17AM PST, ID: 21044073

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 11:26AM PST, ID: 21044172

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 12:10PM PST, ID: 21044569

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 01:35PM PST, ID: 21045357

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: File Compression Utilities, Microsoft Visual Basic.Net, .Net Editors & IDEs
Tags: .Net
Sign Up Now!
Solution Provided By: jcoehoorn
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.04.2008 at 01:57PM PST, ID: 21045554

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 12:05AM PST, ID: 21048551

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 12:40AM PST, ID: 21048640

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628