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