Of course. You need to write python covers to go through dirs. You can find many recipes on stackoverflow. Here is my simple function that returns a list of subdirectories in the current directory (and ignore hidden directories starting with '.' - dot)
def getSubdirs(abs_path_dir) : lst = [ name for name in os.listdir(abs_path_dir) if os.path.isdir(os.path.join(abs_path_dir, name)) and name[0] != '.' ] lst.sort() return lst
For example, I have dir modules that contain foo, bar, ice.
corePath = 'abs/path/to/modules' modules = getSubdirs(corePath) # modules = [bar, foo, ice] for module in modules : sources += Glob(os.path.join(corePath, module, '*.cpp'))
You can improve the getSubdirs function by adding recursion and delving deeper into subdirs.
source share