Find for files within a list of subfolders

Helo
Is there a better way to search within a list of subfolders :

A_START_PATH="/data_1/data_2"
#
# dir2, dir3, dir6,  ..... dir59 exists
#

A_LIST="$A_START_PATH/dir1 $A_START_PATH/dir4 $A_START_PATH/dir5"
 find "$A_LIST" -type f -name"*.txt"

Now searching for all files in any subdirs named 'src' within dir1, dir4, dir5

find ..................

It's okay.
If all of you directories start with $A_START_PATH
then you can perhaps cd to it and use shorter names (relative to the current directory).

cd "$A_START_PATH" || exit
A_LIST="dir1 dir4 dir5"
find $A_LIST -type f -name"*.txt"

$A_LIST must not be in qutoes, otherwise the shell won't split it into words.

2 Likes

Thank you very much