If the data of the two files is expected to be exactly the same, you can get the MD5 checksum of each file in the second folder; sort the list; and for each image in the first folder, search for a matching checksum. On OSX, the command is "md5", but, in Linux it is md5sum.
md5 * | awk '' | sort
Or, if you want an even more automated way,
md5 (SecondFolder)/* > /tmp/second_folder.txt md5 (FirstFolderFile) | awk '' | grep -f - /tmp/second_folder.txt