Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,

I'm currently using Dotnet 4.0 with VS 2010..
I want to test zip file using DotnetZip library.

this following is my coding :
C#
using Ionic.Zip;

namespace testzip
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {           
            using (ZipFile zip = new ZipFile())
            {
                string inputdirectory = @"D:\BackUp\20130102.bak";
                string outputdirectory = @"D:\BackUp\20130102.ZIP";
                inputdirectory = inputdirectory.Replace("\\", "\\\\");
                outputdirectory = outputdirectory.Replace("\\", "\\\\");
                DirectoryInfo di = new DirectoryInfo(inputdirectory);
                zip.AddFile(inputdirectory);
                //zip.AddDirectory(inputdirectory, "ZipTest");
                zip.Comment = "This zip file is created using DotNetZip library";
                zip.Save(outputdirectory);
            }
        }

this code is working fine... I can zip my file name 20130102.bak successfully, but when i use Winzip or winrar to extract -> then choose extract here-> it not only extract my file, but also include sub folder name BackUp.
I want to zip and extract without sub folder, Please help me...
Posted

This is a setting for winzip, it has nothing to do with your code.
 
Share this answer
 
Dear Christian,

Thank for your quick reply...
But i wonder that if i use winzip or winrar to zip other file, for example file name 123.bak .Then i use winzip to extract here it not include sub folder. it give me only this file.
Ex : 1/ my file name is 123.bak--> after zip this with winzip -->file name is 123.zip
2/ use winzip--> extract here --> 123.back

That why i think it not winzip setting problem.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900