Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
lza -> 7za, btw. Thanks! –  Zac B Jul 5 '12 at 14:12
    
@Zac B: Fixed...sorry. –  martineau Jul 5 '12 at 16:57
add comment

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/

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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