I have a directory A with a large number of sub directories and files and want to get a list of all files named foo that are inside of a directory in A that matches *bar. E.g.:
- Yes:
./goldbar/fiz/baz/foo - Yes:
./leadbar/foo - No:
./candy/figbar/foo
I have the some additional constraints:
- I must not descend into directories that don't match the
*bar(this is a necessary optimization as it would take to long to scan those) - I can't allow the shell to do the glob expansion because it returns to many results: (i.e.
find *bar -type f -name foofails)
I think that the -path flag would give me the results I need but I don't know if it fits the first of the above constraints.
Edit: Assume that there are n*10k directories in A that match *bar. i.e. anything that tries to build a command with all of them (as opposed to handling each one in tern) will fail.