C#使用DotNetZip对zip压缩包进行添加删除操作

参考:http://stackoverflow.com/questions/9855155/how-can-i-delete-a-directory-in-a-zip-file-using-net

 

DotNetZip下载:http://sighspms.googlecode.com/files/DotNetZipLib-DevKit-v1.9.zip

 

using System;

using System.IO;

using Ionic.Zip;



namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

        {

            ZipFile zip = new ZipFile("e:\\appbox_1.3.0-163web.apk");



            for (int x = zip.Count - 1; x >= 0; x--)

            {

                ZipEntry e = zip[x];

                if (e.FileName.Substring(0, 9) == "META-INF/")

                    zip.RemoveEntry(e.FileName);

            }





            zip.Save();

        }

    }

}

 

你可能感兴趣的:(zip)