diff options
author | Florian Pritz <f-p@gmx.at> | 2009-05-21 23:43:26 +0200 |
---|---|---|
committer | Florian Pritz <f-p@gmx.at> | 2009-05-21 23:43:26 +0200 |
commit | 2a41845a52cb2763160ba415b163d493d278c5cf (patch) | |
tree | 9543050c47ec5382d15d78308a637d0ff2255ce2 /a | |
parent | eb55b0c3880705be8684a4da02b78368e0448b84 (diff) | |
download | bin-2a41845a52cb2763160ba415b163d493d278c5cf.tar.gz bin-2a41845a52cb2763160ba415b163d493d278c5cf.tar.xz |
new archive script
Diffstat (limited to 'a')
-rw-r--r-- | a | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,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() |