Find all files matching the pattern "${pattern}" in their name and execute ${my_command} for each of them with the file path as argument
find ${directory} -name "${pattern}" -print0 | xargs -0 ${my_command}