0
|
1 #!/usr/bin/env python
|
|
2
|
|
3 """
|
|
4 Create a zip archive
|
|
5
|
|
6 usage: zip.py [options]
|
|
7
|
|
8 See below for options
|
|
9 """
|
|
10
|
|
11 import os, subprocess, sys
|
|
12 import zipfile
|
|
13
|
|
14 def __main__():
|
|
15
|
|
16 # init
|
|
17 output_zip = sys.argv[1]
|
|
18
|
|
19 # create the zip archive
|
|
20 myarchive = zipfile.ZipFile(output_zip, 'w', allowZip64=True)
|
|
21
|
|
22 # for all files, write in the archive
|
|
23 for i in range(2, len(sys.argv),2):
|
|
24 myarchive.write(sys.argv[i], os.path.basename(sys.argv[i+1]))
|
|
25
|
|
26
|
|
27
|
|
28
|
|
29
|
|
30
|
|
31 if __name__ == "__main__": __main__()
|
|
32
|