A simple script? The following script is both simple and “pure” AppleScript. It has been tested under OS X 10.10.4 and seems to work pretty well when the number of subfolders and pictures is small. You might want to give it a try.
set theNewFolder to choose folderwith prompt "Choose the destination folder."
set theOriginalFolder to choose folderwith prompt "Choose the folder containing your images."
set theNumbers to {12345, 23456, 34567, 45678, 56789, 67890} -- to replace with your own list of numbers
tell application "Finder" to set theFiles to files of the entire contents of theOriginalFolder as alias list
set theFilesToDuplicate to {}
repeat with thisNumber in theNumbers
set thisNumber to contents of thisNumber
repeat with thisFile in theFiles
set thisFile to contents of thisFile
if (thisFile as text) contains (thisNumber as text) then
copy thisFile to the end of theFilesToDuplicate
exit repeat
end if
end repeat
end repeat
tell application "Finder" to duplicatetheFilesToDuplicatetotheNewFolder with replacing