All pastes #1296027 Raw Edit

Miscellany

public python v1 · immutable
#1296027 ·published 2008-12-30 00:21 UTC
rendered paste body
#!/usr/bin/env pythonimport os, sys, zipfileif len(sys.argv) != 2:    print\"""Usage: %s dirRemoves all "fuckupscaled cover lol"-type fakes in dir by deleting any zip filewith just a single file in it named "0001.jpg".""" % sys.argv[0]    sys.exit(1)baseDir = sys.argv[1]for name in os.listdir(baseDir):    path = os.path.join(baseDir, name)    try:        zip = zipfile.ZipFile(path)    except (zipfile.BadZipfile, IOError):        continue    if zip.namelist() == ["0001.jpg"]:        os.remove(path)