Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#4.0 ZIP
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 :
using Ionic.Zip;
namespace testzip
    public partial class Form1 : Form
        public Form1()
        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.AddDirectory(inputdirectory, "ZipTest");
                zip.Comment = "This zip file is created using DotNetZip library";
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 1-Jan-13 17:56pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is a setting for winzip, it has nothing to do with your code.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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
2/ use winzip--> extract here --> 123.back
That why i think it not winzip setting problem.

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

  Print Answers RSS
0 Maciej Los 600
1 OriginalGriff 455
2 Sascha Lefévre 289
3 Richard Deeming 195
4 Abhinav S 190
0 Sergey Alexandrovich Kryukov 9,693
1 OriginalGriff 9,185
2 Peter Leow 5,112
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,876

Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100