There are probably more elegant ways than this to do it, but here's my offering.
for i in /cdrom/RedHat/RPMS/*; do
for j in /var/log/rpmpkgs/*; do
if [ -e "$i" -a -e "$j" ]; then
mv $j /path/to/keeper-files/
For each file in the first directory, compare it to every file in the second. If you find a match, move it to another (temporary) location.
Keep looping until all files in the first location have been compared to every file in the second location, with all matches moved for safekeeping.
Then remove the remainder.
You can flesh out the code to move the saved files back to the original location.
Edit: lightner thinks more elegantly than I do, and types faster than I do. I like his solution better than mine.