Catering for illegal characters within a .zip folder to be extracted

Hello all

I’m currently working on a bulk-unzipper process.

I’m running into issues where if a file within the .zip has an illegal character, (eg: “:”), it throws an exception when the process attempts to extract the file (using Invoke Method -> System.IO.Compression.ZipFile -> ExtractToDirectory)


I’ve read some threads but I am not clear on how I can cater for this when the file is within a .zip.

I’d appreciate any help!

Here’s a solution using Invoke Code activity.

Inspired by these two posts on stackoverflow which deal with this issue in C#

1. Ensure you have the package System.IO.Compression.ZipFile installed -

2. Use an invoke code with the following code

Dim extractPath As String
Using zip As ZipArchive = ZipFile.Open(zipFilePath, ZipArchiveMode.Update)
      For Each entry As ZipArchiveEntry In zip.Entries
    extractPath = outFilePath + String.Join("_", entry.Name.Split(Path.GetInvalidFileNameChars()))
End Using

This basically opens is file in the zip, and extracts it with a clean file name.

I have two arguments, zipFilePath (the zip file to unzip) & outFilePath (the folder to put the contents)


3. Import System.IO.Compression Namespace

XAML attached

extractZip.xaml (6.5 KB)

1 Like

Nailed it, thank you!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.