I am pretty new to python and I need to search for a folder that has a name like: vvl*cpp and is always present inside a directory named test. But the problem is the depth of the test directory is not known.
I tried:
dir_name=glob.glob('./[a-z,_]*/test/vvl*cpp')
file_dict={}
for i in dir_name:
name=re.compile(r"\.\/[a-z,_]*\/test\/vvl_")
file_name=name.sub("",i)
file_dict[file_name]=i
for key in sorted(file_dict.iterkeys()):
print "%s: %s" % (key, file_dict[key])
But it only searches in the sub directory but as i mentioned i have no idea about the depth of test directory. It may be 1 it may be 10. Please suggest me some way out. I am using python2.6