Skip to content
Snippets Groups Projects

Extraire un tar

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Gregory.Ooghe

    Script Python pour extraire des .tar.gz ou .tgz

    Edited
    targz.py 315 B
    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>')
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment