3

I have a rather large (~500GB) 7-zip archive. I originally made it when I had more space available, and did so at rather fast, low-compression settings.

Now things are tight, and I'd like to try and compress it down even more. However, I lack the free space to decompress and recompress it. (That's kinda the problem to begin with).

Is there any way I can recompress it inline? Of course, I could easily do this with a .tgz archive on Linux using streams, and I'm hoping there's something similar.

I'm using 7z because I'm normally on Windows, but I can use either Linux or Windows for this specific job.

2
  • Even if you were to recompress it without storing the uncompressed data anywhere, you’d still need space for both the current archive and the recompressed archive.
    – Daniel B
    Commented Sep 8, 2015 at 16:57
  • There is no way to recompress inline using 7-Zip as of 2023-01-05 - see sourceforge.net/p/sevenzip/discussion/45797/thread/810b852373
    – Nnnes
    Commented Sep 8, 2023 at 16:13

1 Answer 1

0

Depending on the similarities of your files, one option would be to compress the archive a second time, known as double compression. This in theory combines all of the files in your archive with the other files in your archive, thus making it an extremely compressed file. The benefits will vary as to what type of files you're using though. One problem you might have is not enough space to compress your compressed files, though it's worth a shot to at least see what the estimated end result will be.

5
  • 3
    No, that won’t work. Compressing raises entropy so much, compressing it again will most likely make the file even larger.
    – Daniel B
    Commented Sep 8, 2015 at 16:28
  • I think you've misunderstood me. I'm not saying just take a single file, compress it, and then compress it again. The majority of the time this will make the file larger. I'm talking about taking multiple files, compressing them into a file, and compressing that file. The second compression combines all of the original files together to make them even smaller. As I mentioned it varies as to what file type you're using to how much of a benefit you'll gain, but in some cases it can make files extremely small. Commented Sep 8, 2015 at 16:29
  • 1
    No, I think I understood perfectly fine. Compressing again never helps. Because if you compress two similar files separately, the resulting archives are most likely not similar at all. That’s just how compression algorithms work. That’s also why, for maximum efficiency, a completely solid archive (no blocks) is needed: All files are compressed in one process.
    – Daniel B
    Commented Sep 8, 2015 at 16:56
  • All I can say is that I know first hand this works with things like text documents, and I've heard stories of 200 MiB files turning into around 40 MiB. Again, it's completely situational as to if you'll see an effect and the compression method matters a lot, but it does work. Commented Sep 9, 2015 at 6:52
  • Generally speaking, you would be much better off making a new compressed file from ALL the uncompressed files. The oversimplified version of compression is that it finds frequently used strings of data, and makes a table mapping that long string to a stronger one, potentially with fractional bytes. You would be better off finding repeats across the originals than finding repeats in the encoded values
    – Adam Tegen
    Commented Oct 1, 2021 at 15:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .