You don't need a loop for doing this. Have a look at the
find command, that is what you are looking for. For example:
Code:
find $DIRECTORY -name "$PATTERN"
will find the files that match $PATTERN in the directory $DIRECTORY.
For more information look at