C#使用DotNetZip對zip壓縮包進行添加刪除操做

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

 

DotNetZip下載:http://sighspms.googlecode.com/files/DotNetZipLib-DevKit-v1.9.zipapp

 

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();
        }
    }
}
相關文章
相關標籤/搜索