Skip to content

Instantly share code, notes, and snippets.

@jackmaney
Created August 23, 2013 21:41
Show Gist options
  • Save jackmaney/6324323 to your computer and use it in GitHub Desktop.
Save jackmaney/6324323 to your computer and use it in GitHub Desktop.
Tarballing a directory in Python
import tarfile
dir = "/some/directory"
tar = tarfile.open(dir + "/some_file.tar.gz",'w:gz')
tar.add(dir + "/some_subdirectory",arcname='some_subdirectory')
tar.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment