Click here to Skip to main content
11,803,019 members (50,124 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB VB.NET
I want to remove a folder (META-INF) from a .ZIP file, I have tried to do this before but failed. Does anyone have a code I can use to remove a folder?

I REALLY NEED HELP! I have until the 10th to release my program as planned, and I don't want to delay it again!

I have tried to search numerous times! Thats the problem. I found NO code that could help and I tried to do it on my own and got an error saying 'Entry does not exist'...

Here's a code:
Dim selection = zip1.SelectEntries("*.*", "META-INF")
For x = selection.Count - 1 To 0 Step -1
	Dim e As ZipEntry = selection(x)

Well now I have the code and no error comes up but It still does not delete it... Can anyone point out where I went wrong here?

Dim Threshold As New String("META-INF")
Using zip As ZipFile = ZipFile.Read("C:\Users\" + GetUserName + "\AppData\Roaming\MCqTools\Mod_p\")
    Dim MarkedEntries As New System.Collections.Generic.List(Of ZipEntry)
    Dim e As ZipEntry
    For Each e In zip
        If (e.IsDirectory = Threshold) Then
        End If
    Dim folderMETA As ZipEntry
    For Each zombie In MarkedEntries
End Using
Posted 3-Dec-12 14:35pm
Edited 4-Dec-12 10:04am
Expert Coming at 4-Dec-12 0:21am
We don't just hand out source code on this site. If you wouldn't mind posting some code that shows what problems you are facing, what you have tried, and a more specific question people should be able to start helping.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Based on the example "Read in a zip file, remove a few entries, save the file" from VB.NET Examples[^] you should be able do remove all files that have "META-INF" in the file name.

Use to ZipEntry[^] class to access the FileName[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 335
1 KrunalRohit 291
2 F-ES Sitecore 270
3 CPallini 270
4 Sergey Alexandrovich Kryukov 234
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,735
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 4 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100