I have a folder structure with three levels, A, B, and C. Level A only contains the folders for B, and each B folder contains a file that I want. However, some B folders may contain a C level that also contains the file, but I do not want it. I would like to use the recursive check with dir search to find all the B level files, but don't know how to keep away from the C level files.
list = dir(fullfile(Alevel,'**','filename.txt'));
Is there a way to use dir to exclude the C level results?