I need to remove one folder called "META-INF". It contains some files. How can I delete that folder, along with all the files in it, without typing all of their names? I can't extract all the files, delete the directory with all the files, and then pack the zip again, because the zip has many files (~1800).
Asked
Active
Viewed 1,969 times
2
-
Is RemoveEntry() not working? Edit: Look at this http://stackoverflow.com/questions/9855155/how-can-i-delete-a-directory-in-a-zip-file-using-net Possible duplicate? – jAC Jan 06 '13 at 15:05
-
Nice to hear that, you're welcome! – jAC Jan 08 '13 at 16:33
2 Answers
1
I used this:
int x;
for (x = 0; x < zip.Count - 1; x++)
{
ZipEntry e = zip[x];
if (e.FileName == "META-INF/")
{
zip.RemoveEntry(e.FileName);
}
}

GemHunter1
- 441
- 1
- 4
- 15
0
You can use something like this:
var matches = fileSelector.SelectEntries(yourZipFile,"META-INF");
for(int i = 0;i < matches.Length; ++i)
{
yourZipFile.RemoveEntry(matches[i].FileName);
}

prthrokz
- 1,120
- 8
- 16
-
-
@GemHunter1 It seems that solution suggested by Janes is working for you but he is also pointing to RemoveEntry(), that is what I have used within my code :) – prthrokz Jan 08 '13 at 17:51
-
And now as I see, the solution he pointed out and mine are nearly identical :) – prthrokz Jan 08 '13 at 17:52
-