Information about files within archives

May 31, 2010 at 10:28 PM

Hello :),

first: thank you very much for creating such a powerful library and 7zip itself too.

I am trying to create a program that lists all files inside a zipped / rared file.

Listing the filenames is easy, but is it possible to get the compressed and uncompressed filesizes of each file within that archive?
Or even further: is it possible to get a CRC-value for each of the files?

I want to compare the CRC values (file outside the archive <-> the same file inside an archive) to determine if it's exactly the same file or not.

If there's no way to compare CRC values, then I'd resort to comparing filesizes + filenames.. so long I can only find a way to list filenames, but no filesizes though.

Thank you very much for your hard work in advance and I'd be happy if there was a way to get the filesize of the files within the archive without having to extract them.

 

divStar

May 31, 2010 at 10:48 PM

Hello again.. I am sorry, I didn't figure it out by myself before posting here.

The solution is to use the archives ArchiveFileData collection.

SevenZipExtractor szip = new SevenZipExtractor(FILENAME);
foreach (ArchiveFileInfo adata in szip.ArchiveFileData)
{
         Console.WriteLine(adata.FileName);
         Console.WriteLine(adata.Size);
         Console.WriteLine(adata.Crc);
}

Thank you and sorry to have bothered :D. I was sure that there had to be a way of getting all the information without having to extract it.

divStar.

Oct 2, 2010 at 5:50 AM

Thanks for posting this info divStar -- I was looking for the same information.