Along with the omnipresent zip, they do have ready-to-use tools for most compression formats built right into the operating system.
Windows user lack the luxury. To unzip a tar or tar.gz format in windows, a 3rd party download like winrar is required.
Reluctant to install one more software in my virtual box window, I was looking for a download free solution. This exploration brought me to the standard python module tarfile.
This did the trick.
Here’s a simple small python script to untar a tar or tar.gz file in windows without any download, provided you have python installed!!
# -*- coding: utf-8 -*- """ Created on Thu Feb 20 06:59:20 2014 @author: Sukhbinder Singh Tarfile test """ import tarfile,sys def untar(fname): if (fname.endswith("tar.gz")): tar = tarfile.open(fname) tar.extractall() tar.close() print "Extracted in Current Directory" else: print "Not a tar.gz file: '%s '" % sys.argv if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: '%s filename'" % sys.argv sys.exit(0) untar(sys.argv)
Wow! That’s why python rocks!!