tags:

views:

268

answers:

1

Trying to extract files to a given folder ignoring the path in the zipfile but there doesn't seem to be a way.

This seems a fairly basic requirement given all the other good stuff implemented in there.

What am i missing ?

code is -

using (Ionic.Zip.ZipFile zf = Ionic.Zip.ZipFile.Read(zipPath))
{
    zf.ExtractAll(appPath);
}
+1  A: 

You'll need to remove the directory part of the filename just prior to unzipping...

        using (var zf = Ionic.Zip.ZipFile.Read(zipPath))
        {
            zf.ToList().ForEach(entry =>
            {
                entry.FileName = System.IO.Path.GetFileName(entry.FileName);
                entry.Extract(appPath);
            });
        }
Software.Developer
doh! didn't think of that :) thanks much
Kumar