11,567 questions
Ignoring the challenges of finding an arbitrary file in a subfolder contained within the zip file then you just need to find the zip entry first and then extract it.
static bool ExtractFile ( string zipFile, string filename, string targetPath )
{
var zip = ZipFile.OpenRead(zipFile);
var entry = zip.GetEntry(filename);
if (entry == null)
return false;
entry.ExtractToFile(targetPath, true);
return true;
}
if (!ExtractFile("myzip.zip", "abc.txt", "c:\destination\abc.txt"))
//Not found
If you need to find the file in an arbitrary subfolder then you'll need to search for it via the Entries
.