Does python's glob function support wildcards with variable depth?
Sorry - it does not. You will have to probably write few lines of code using os.walk:
for root, dirs, files in os.walk('/starting/path/'):
for myFile in files:
if myFile == "index.html":
print os.path.join(root, myFile)
I have just released Formic which implements exactly the wildcard you need - '**' - in an implementation of Apache Ant's FileSet and Globs.
The search can be implemented:
import formic
fileset = formic.FileSet(include="/www.dmoz.org/Science/Environment/**/index.html")
for file_name in fileset.qualified_files():
# Do something with file_name
This will search from the current directory. I hope this helps.