#!/usr/bin/env python """ This script extracts .tar, .tar.gz, .tar.bz2, .gz and .zip archives """ import sys import os def unpack(s): if (s.find('.tar.gz') != -1): os.system("tar -xvvzf " + filename) elif (s.find('.tar.bz2') != -1): os.system("tar -xvvjf " + filename) elif (s.find('.tar') != -1): os.system("tar -xvvf " + filename) elif (s.find('.gz') != -1): os.system("gunzip" + filename) elif (s.find('.zip') != -1): os.system("unzip " + filename) else: print "Wrong archive or filename" try: filename = sys.argv[1] unpack(filename) except IndexError: print "Invalid filename"