"B Mahoney" wrote:
Is there a Python 'find' -like utility that will continue the file
search through any zippped directory structure on the find path?
something like this?
# File: zipfind.py
import fnmatch, os, sys, zipfile
program, root, name = sys.argv
for dirpath, dirnames, filenames in os.walk(root):
for file in fnmatch.filter( filenames, name):
print os.path.join(di rpath, file)
for file in fnmatch.filter( filenames, "*.zip"):
try:
zip = zipfile.ZipFile (os.path.join(d irpath, file))
except zipfile.BadZipf ile:
pass # cannot read this file
else:
for f in fnmatch.filter( zip.namelist(), name):
print os.path.join(di rpath, file) + ":" + f
$ python zipfind.py aggdraw "README*"
aggdraw/README
aggdraw/agg2/README.txt
aggdraw/dist/aggdraw-1.1b3-20050925.zip:ag gdraw-1.1b3-20050925/README.txt
</F>