#!/usr/bin/env python '''A program to create tar files from a file or directory.''' import sys import os from anuga.utilities.system_tools import untar_file # assumed program name - refreshed from command line args Prog_Name = 'untar_file.py' # print usage info. and exit def usage(): print 'usage: %s []' % Prog_Name print 'where is the path to the file to untar,' print ' and is the directory to write the results into.' sys.exit(10) # get program name # does this work on Windows? Prog_Name = os.path.basename(sys.argv[0]) # check args if len(sys.argv) != 2 and len(sys.argv) != 3: usage() # create the tarred/compressed file if len(sys.argv) == 2: untar_file(sys.argv[1]) else: untar_file(sys.argv[1], sys.argv[2])