With the SharpZip lib I can easily extract a file from a zip archive:
FastZip fz = new FastZip();
string path = "C:/bla.zip";
fz.ExtractZip(bla,"C:/Unzips/",".*");
However this puts the uncompressed folder in the output directory. Suppose there is a foo.txt file within bla.zip which I want. Is there an easy way to just extract that and place it in the output directory (without the folder)?
Assuming you know this is the only file (not folder) in the zip:
If you need to handle other possibilities, or e.g. getting the name of the zip-entry, the complexity rises accordingly.
The
FastZip
does not seem to provide a way to change folders, but the "manual" way of doing supports this.If you take a look at their example:
As they note, instead of writing:
you can write:
to remove the folders.