I would like to list all files recursively in a directory. I currently have a directory structure like this:
src/main.csrc/dir/file1.csrc/another-dir/file2.csrc/another-dir/nested/files/file3.c
I've tried to do the following:
from glob import glob glob(os.path.join('src','*.c')) But this will only get be files directly in the src subfolder, e.g. I get main.c but I will not get file1.c, file2.c etc.
from glob import glob glob(os.path.join('src','*.c')) glob(os.path.join('src','*','*.c')) glob(os.path.join('src','*','*','*.c')) glob(os.path.join('src','*','*','*','*.c')) But this is obviously limited and clunky, how can I do this properly?
glob('src/**/*.c')work in this case?