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?
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.
some how I missed that... pretty easy.
long size = 0; for (var i = 0; i < zip.NumEntries; i++) size += zip.GetEntryByIndex(i).UncompressedLength64;
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...