Skip to content

Instantly share code, notes, and snippets.

@JeffAMcGee
Created September 6, 2012 23:25
Show Gist options
  • Save JeffAMcGee/3661277 to your computer and use it in GitHub Desktop.
Save JeffAMcGee/3661277 to your computer and use it in GitHub Desktop.
tool to create tar.gz files
#!/usr/bin/env python
import tarfile
import sys
"""
Script to replace tar -czf for turning in CSCE 470 assignments.
Author: Jeffrey McGee, based on an idea by John Keech
Usage: python tarhw.py hw2
"""
def save_tarball(label):
with tarfile.open(label+".tar.gz", "w:gz") as tar:
tar.add('.git')
if __name__=="__main__":
label = sys.argv[1]
if label:
save_tarball(label)
else:
print "Usage: python tarhw.py hw2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment