I have a set of .bam, files scattered inside a tree of folders. Not every directory contains such a file. I know how to recursively get the path of the files themselves using glob, but not the directory containing them.
import glob2 bam_files = glob2.glob('/data2/**/*.bam') print bam_files The above code gives the .bam files, but I want just the folders. Wondering if there is a direct way to do this using glob without regular expressions.