Would a simple find foo -type f not work?
EDIT: Wait, from your example you are looking for files in any directory named foo. The first thing that comes to mind is:
find $ROOT_PATH -type d -name foo | xargs -n1 -I{} find {} -type f
Would a simple find foo -type f not work?
EDIT: Wait, from your example you are looking for files in any directory named foo. The first thing that comes to mind is:
find $ROOT_PATH -type d -name foo | xargs -n1 -I{} find {} -type f