Extract specific file extension files with DotNetZip's ExtractSelectedEntries "Illegal characters in path."

583 Views Asked by At

I'm trying to extract files from within a zip file using DotNetZip.

When I use the wildcard character I get an error "System.ArgumentException: 'Illegal characters in path.'" on ExtractSelectedEntries

The zip file contains a single text file, no illegal characters so I think the error is relating to the asterix rather than illegal characters within the zip.

            using (ZipFile zip = ZipFile.Read(@"C:\Media\test.zip"))
            {
                zip.ExtractSelectedEntries("name=*.txt",null , @"C:\Media\", ExtractExistingFileAction.OverwriteSilently);
            }

If I specify the exact file it extracts as expected:

            using (ZipFile zip = ZipFile.Read(@"C:\Media\test.zip"))
            {
                zip.ExtractSelectedEntries("testfile.txt",null , @"C:\Media\", ExtractExistingFileAction.OverwriteSilently);
            }

I'm using DotNetZip 1.15.0 via NuGet (https://github.com/haf/DotNetZip.Semverd) on VisualStudio 2017.

0

There are 0 best solutions below