I am using Ionic zip in my WCF service to unzip files uploaded by a 'client'.The files are zipped using Ionic zip.However,there have been instances where the zipped files were 'corrupted'.Since my code scans the entire folder to look for zipped files,exceptions were thrown as it was picking up the same 'corrupted' zipped files everytime.This stopped all the other files from being processed.Here's the code:
foreach (string filePath in Directory.GetFiles(ZippedFilesDestinationFolder))
{
using (ZipFile zip1 = ZipFile.Read(filePath))
{
foreach (ZipEntry e in zip1)
{
e.Extract(unpackdirectory, ExtractExistingFileAction.OverwriteSilently);
}
}
}
I want to move the corrupted file to another folder and continue extracting the other zipped files in the folder.How should the code be modified to achieve this?