I am extracting and then compressing a large set of dtaa in memory and then attaching them to an email as zipped csv's. I would like to record in my database how large the original extract was in KB.
Is there anyway to do this currently?
asked Jun 08 '12 at 15:46
If you have a zip archive, you can use Chilkat Zip to open it (via the OpenZip method). Then iterate over the entries, getting each ZipEntry object, and then examine the ZipEntry.UncompressedLength property of each. This gives you the uncompressed size of each file contained within the .zip.
answered Jun 08 '12 at 18:21
some how I missed that... pretty easy.
I'm assuming the directories return a length of 0... otherwise I have to exclude them.
It would be nice to be able to reference the entries as an IEnumerable<zipentry>
sizeInKb = zip.Entries.Where(x=>!x.IsDictionary).Sum(x=>x.UncompressedLength64/1024);
Anyhow I should be good to go with this...