how to extract to a directory that differs from the dir in the zip entry?

Aug 17, 2010 at 3:56 AM

i want to extract a zip archive, in the archive:

test.zip

     tool_3001                                 //directory

           subdir                               //directory

           files                                  //files

 

if i extract the test.zip

using (ZipFile zip = ZipFile.Read(test.zip))
                {
                    foreach (ZipEntry e in zip)
                    {
                        e.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);
                    }
                }

it will be as following:

unpackDirectory

      tool_3001                                 //directory

           subdir                               //directory

           files                                  //files

 

but i want to remove the root directory in archive, how can i do?

unpackDirectory

           subdir                               //directory

           files                                  //files

 

 

Coordinator
Aug 20, 2010 at 10:59 AM
Rename the zipfile entries before extracting, or rename the filesystem directory after extracting.