Bill Noble
Bill Noble

Reputation: 21

How to untar and gzip the extracted files in one operation?

I have a huge (500GB) gzipped tar file, and I want to extract all the files in it. The tar file is gzipped, but the files in it are not. The problem is that if I extract them all like this

tar xzf huge.tgz

then I run out of space.

Is there a way to simultaneously extract and gzip the files? I could write a script to do

tar tzf huge.tgz

and then extract each file and gzip it, one after the other. But I was hoping there might be a more efficient solution.

Upvotes: 0

Views: 297

Answers (1)

Mark Adler
Mark Adler

Reputation: 112284

You would have to write a program that uses, for example, libarchive and zlib to extract entries and run them through gzip compression.

Upvotes: 0

Related Questions