I\'m using the following code to extract a tar file:
import tarfile
tar = tarfile.open(\"sample.tar.gz\")
tar.extractall()
tar.close()
However,
You can specify the members
parameter in extractall()
with tarfile.open(, 'r') as tarball:
tarball.extractall(path=, members = track_progress(tarball))
def track_progress(members):
for member in members:
# this will be the current file being extracted
yield member
member
are TarInfo
objects, see all available functions and properties here