from pathlib import Path for file_path in Path('src').glob('**/*.c'): print(file_path) # do whatever you need with these files