def zipdir(path, zipn): for root, dirs, files in os.walk(path): for file in files: zipn.write(os.path.join(root, file))