Compile C with some optimizations
[llpp.git] / misc / cbzl.py
blobb850a0d893e9ab5b0d48127a3ba57f8c11b0d7fe
1 #!/usr/bin/env python
2 # based on http://doeidoei.wordpress.com/2010/11/23/compressing-files-with-python-symlink-trouble/
3 import os, sys, zipfile
5 help = """\
6 usage: find . -name \*.jpg -or -name \*.png -print0 | python cbzl.py curimgs.cbz
7 or: locate -0 .jpg | python cbzl.py alljpegs.cbz
8 """
10 if len (sys.argv) < 2:
11 print (help)
12 sys.exit (1)
14 with zipfile.ZipFile (sys.argv[1], "w") as z:
15 zerosep = sys.stdin.read ()
16 files = zerosep.split ('\0')
17 for name in files:
18 a = zipfile.ZipInfo ()
19 a.filename = os.path.basename (name)
20 a.create_system = 3
21 a.external_attr = 2716663808
22 z.writestr (a, name)