Tarfile .bz2
Jordan
jordan.taylor2 at gmail.com
Mon Dec 11 16:08:55 EST 2006
When using python to create a tar.bz2 archive, and then using winrar to
open the archive, it can't tell what the compressed size of each
individual file in the archive is. Is this an issue with winrar or is
there something that needs to be set when making the archive that isn't
there by default.
example archive:
#Note, the tabs on this are not really tabs, so good luck copying it
correctly
import os, tarfile
archive = tarfile.open("archive.tar.bz2","w:bz2")
for thing in os.listdir(somepath):
nthing = somepath+thing
if os.path.isfile(nthing): # somepath must end in "\\" for this to
work
info = archive.gettarinfo(nthing)
archive.addfile(info,file(nthing,'rb'))
archive.close()
---
Thanks,
Jordan
More information about the Python-list
mailing list