Entry
How can I create compressed tarfiles, ie. lots of files inside a compressed file, using either the tarlib.py or tar.py ( found in Zope and gzip and/or zlib?
Aug 24th, 2000 20:46
unknown unknown, Martin von Loewis
Without trying, it appears that Zope's tar.py already handles
compressed files.
Let names contain a list of all files to add, I'd say the following
might work:
archive = tar.tgzarchive("foo")
for n in names:
data = open(n).read()
archive.add(n, data)
archive.finish()
open("foo.tgz").write(archive)
It appears as if this would keep the compressed file in memory,
though; there is apparently no streaming tar library.