How to check if a file exists in a zip file

Is there a way to check if a file exists inside a zip file? The File Exists activity doesn’t seem to work. I could pull the properties of the zip file, and if it’s 0kb, then I would know it’s empty. I was hoping for a better solution.

You can achieve this by using c# code in invoke code activity.

Please refer below c# code.

using (ZipArchive archive = ZipFile.OpenRead(zipPath))
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
Console.WriteLine(entry.FullName);
//entry.ExtractToFile(Path.Combine(destFolder, entry.FullName));
}
}

1 Like

Hi @PWilliams,

you can also refer below thread if you would like to go for python based solution:

Regards
Sonali

1 Like

Thank you for the fast replies. Ended up just going a simple route of getting file properties.

1 Like

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