source: branches/numpy_misc/tools/tar_file/untar_file.py @ 7077

Last change on this file since 7077 was 6642, checked in by rwilson, 16 years ago

Minor(ish) changes to untar tool.

File size: 855 bytes
Line 
1#!/usr/bin/env python
2
3'''A program to create tar files from a file or directory.'''
4
5import sys
6import os
7from anuga.utilities.system_tools import untar_file
8
9
10# assumed program name - refreshed from command line args
11Prog_Name = 'untar_file.py'
12
13# print usage info. and exit
14def usage():
15    print 'usage: %s <tarfile> [<output_directory>]' % Prog_Name
16    print 'where <tarfile>          is the path to the file to untar,'
17    print '  and <output_directory> is the directory to write the results into.'
18    sys.exit(10)
19
20# get program name
21# does this work on  Windows?
22Prog_Name = os.path.basename(sys.argv[0])
23
24# check args
25if len(sys.argv) != 2 and len(sys.argv) != 3:
26    usage()
27
28# create the tarred/compressed file
29if len(sys.argv) == 2:
30    untar_file(sys.argv[1])
31else:
32    untar_file(sys.argv[1], sys.argv[2])
Note: See TracBrowser for help on using the repository browser.