summaryrefslogtreecommitdiffstats
path: root/a
blob: 6ec8e7df8f28e1a715f730ec4b67063bf3cb3bbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/python
#----------------------------------------------------
# Version:      0.1.0
# Author:       Florian "Bluewind" Pritz <f-p@gmx.at>
#
# Copyright (C) 2009 Florian Pritz
#
# Licensed under GNU General Public License v3
#   (see COPYING for full license text)
#----------------------------------------------------
# got bored and a.sh has some problems with spaces
#----------------------------------------------------

import sys
import tarfile

def main():
    if len(sys.argv) == 1:
        sys.stderr.write("No files specified!\n")
        sys.exit(1)

    tarname = sys.argv[1] + ".tar.gz"

    tar = tarfile.open(tarname, "w|gz")
    for name in sys.argv[1:]:
        try:
            tar.add(name)
        except OSError:
            sys.stderr.write("No such file or directory: '%s'\n" % name)
    tar.close()

if __name__ == '__main__':
    main()