DotNetZip Issue

Feb 16, 2012 at 11:40 AM

Hi all,

i am using DotNetZip Library to unzip my zipped files,here is my code

using (ZipFile zip = ZipFile.Read(copyTo))
                {
                    foreach (ZipEntry ttt in zip)
                    {
                        ttt.Extract(filePath3);
                    }
                }
the issue is, it extract like this
folder/folder/files...
i do not need like this..i want to be like this
folder/files...
like we can write click on any zip file and click on extract here.?
how it could be
Mar 2, 2012 at 12:07 PM

I think you are specifying wrong base directory in ttt.Extract(filePath3).This file path should be "folder" not folder/folder.

Example:

Lets Suppose you zip file resides inside C:\Test and filename is MyZipFile.zip.

 using (ZipFile zip = ZipFile.Read(@"C:\Test\MyZipFile.zip"))
            {
                foreach (ZipEntry zipEntry in zip)
                {
                    zipEntry.Extract(@"C:\Test");
                }
            }

 

So base directory should be C:\Test as Extract here will extract into the same folder.