You can use os.walk to move through all files and directories. Then you can perform a simple pattern matching in the file names (for example, the example you asked in the question).
import os
for path, subdirs, files in os.walk('.'):
for name in files:
if '.parq' in name:
print path
, , . , os.path.join
os.path.join(path, name)
, , .
import os
for path, subdirs, files in os.walk('.'):
for name in files:
with open(name) as f:
for line in f:
if 'parq' in line:
print 'Pattern found in directory %s' %path,
print 'in file %s' %name
break