MATLAB: How to list file-paths from different subfolders

listlist filesMATLABselect filessubdirectoriessubfolders

Hi,
I am looking for an option to create a list of paths of files which are stored in different subfolders. I have a big amount of data, which is stored in this way:
C:/directory01/person01/subdirectory01/file01.x
/subdirectory02/file01.x
/subdirectory03/file01.x
C:/directory01/person02/subdirectory01/file01.x
/subdirectory02/file01.x
/subdirectory03/file01.x
and so on...
I want so create different lists of paths which contain e.g. only 'the file01.x's' from 'subdirectory02' from each person.
So something like
C:/directory01/person*/subdirectory02/file01.x
Is this possible? I only find ways to choose every file01.x which exist in directory01 and have to delete afterwards by hand the files from 'subdirectory01' and '~03'
Thank you so much for your help!
Best Eliska

Best Answer

You can use
f=dir('C:/directory01/person*/subdirectory02/file01.x')