I know that when I compress an archive with the 7za utility, it gives me stats like the number of files processed and the amount of bytes processed (the original size of the data).

Is it possible, using the commandline (on linux) or some programming language, to determine:

  • the original size of an archive, before it was compressed?
  • the number of files/directories contained within an archive?

The answer might be "no, just decompress the whole archive and do counting/sizing then", but it would be useful to know if there was a faster/less space-greedy way.


You could pipe the output from 7za l <path to archive> into a text file or directly into a program written in the programming language of your choice.


Well I dont know if it works with 7za. But you can estimate a Tar size before you created the Tar file with this command.

$ tar -cf - /directory/to/archive/ | wc -c

Source: http://www.thegeekstuff.com/2010/04/unix-tar-command-examples/

  • Thanks, but I was hoping for a method that doesn't require me to perform operations when the archive is being created. I want to be able to determine the filecount/estimated size if I just have an archive, and no knowledge of how/when/where it was made.
    – Zac B
    Jul 5 '12 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.