Decompress a .tar.bz2 archive





6
Date Submitted Fri. Aug. 18th, 2006 11:04 AM
Revision 1 of 1
Scripter ASmith
Tags archive | python
Comments 0 comments
Decompress a .tar.bz2 archive in Pytho

###
Description: Decompress a .tar.bz2 archive
URL: http://sebsauvage.net/python/snyppets/index.html
License: Unspecified/Public Domain
###
import tarfile
import bz2
archive = tarfile.open('myarchive.tar.bz2','r:bz2')
archive.debug = 1    # Display the files beeing decompressed.
for tarinfo in archive:
    archive.extract(tarinfo, r'd:\mydirectory') # d:\mydirectory is where I want to uncompress the files.
archive.close()
 

Comments

There are currently no comments for this snippet.

Voting