Extraire un tar
The snippet can be accessed without any authentication.
Authored by
Gregory.Ooghe
Script Python pour extraire des .tar.gz ou .tgz
import os, sys, tarfile
# dans un terminal : py -3 targz.py <nom de l'archive>
try:
tar = tarfile.open(sys.argv[1] + '.tar.gz', 'r:gz') # ou '.tgz'
for item in tar:
tar.extract(item)
print('done')
except:
name = os.path.basename(sys.argv[0])
print(name[:name.rfind('.')], '<filename>')
Please register or sign in to comment