Mercurial > repos > cmonjeau > ziptool
diff zip.py @ 0:e466f86a4520 draft default tip
Imported from capsule None
author | cmonjeau |
---|---|
date | Tue, 07 Jul 2015 08:49:28 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zip.py Tue Jul 07 08:49:28 2015 -0400 @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +""" +Create a zip archive + +usage: zip.py [options] + +See below for options +""" + +import os, subprocess, sys +import zipfile + +def __main__(): + + # init + output_zip = sys.argv[1] + + # create the zip archive + myarchive = zipfile.ZipFile(output_zip, 'w', allowZip64=True) + + # for all files, write in the archive + for i in range(2, len(sys.argv),2): + myarchive.write(sys.argv[i], os.path.basename(sys.argv[i+1])) + + + + + + +if __name__ == "__main__": __main__() +