我的博客小站

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();
        }
    }
}

 

posted on 2013-11-19 17:51  BIGSING  阅读(1255)  评论(0编辑  收藏  举报

导航

我的博客小站