Skip to content

Instantly share code, notes, and snippets.

@scturtle scturtle/zipcomic.py
Created Apr 22, 2011

Embed
What would you like to do?
zip downloaded comics
# coding: utf-8
import os,sys,zipfile
def walkdir(d):
l=os.listdir(d)
nodir=True
for t in l:
p=os.path.join(d,t)
if os.path.isdir(p):
nodir=False
walkdir(p)
if nodir:
fn=d+'.zip'
if os.path.exists(fn):
print 'Skip:',os.path.basename(fn)
break
z=zipfile.ZipFile(fn,'w')
print 'Get:',os.path.basename(fn)
for t in l:
p=os.path.join(d,t)
z.write(p)
z.close()
walkdir(os.path.abspath('.'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.