This is what I have:
glob(os.path.join(\'src\',\'*.c\'))
but I want to search the subfolders of src. Something like this would work:
<
For python >= 3.5 you can use **
, recursive=True
:
import glob
for x in glob.glob('path/**/*.c', recursive=True):
print(x)
Demo
If recursive is
True
, the pattern**
will match any files and zero or moredirectories
andsubdirectories
. If the pattern is followed by anos.sep
, only directories andsubdirectories
match.