I have quite big *.tar.gz
file (10Gb) that contains individuals files (no sub-folders). In Jupyter Notebook it takes several hours to untar this archive. Once all files are extracted, I need to upload them into a storage location.
This is what I currently have:
untar = tarfile.TarFile(tarfilename)
untar.extractall()
untar.close()
Is it possible to extract the content of *.tar.gz
dynamically (i.e. continuously)? Something like this:
with open(tarfilename, "r") as tararchive:
for eachfile in tararchive:
save_to_storage_location(eachfile)
So, instead of waiting until the tar
archive is untarred, I just want to "open" it and move all the content one by one into the storage location.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…