The following script is quite simplistic, but should work if you follow instructions!
run TextEdit (it's in /Applications/Other by default); copy and paste in the following 7 lines into a new file:
JPGList=`find ~/Pictures/cleanup -name '*jpg' -print`
for Image in $JPGList do
Folder=`dirname $Image`
Filename=`basename $Image jpg`
RAW=$Folder$'/'$Filename'cr2'
rm $RAW
done
Select "Save" from the file menu. In the "save as" box, type 'rawdelete' (without apostrophes) as the filename. Uncheck the box at the bottom marked 'if no extension is provided, use txt'. Select your home directory (you user name in the list of folders on the left with the picture of the house) and click 'save'.
Close TextEdit
What this script will do is find all files in the Pictures/cleanup folder and below whose names end in .jpg and try to delete a file with the same name, but ending in .cr2, in the same location. It assumes that NONE of your folders or files have spaces or non-alphanumeric characters in their names. If they do, it will not work properly, so don't run it and let me know what file and folder names look like.
I've put the 'cleanup' bit in there to protect against oddities in your Pictures folder that I can't know about. What you need to do is create this folder (Pictures/cleanup) and use the Finder to drag each top-level image folder to it from the Pictures folder (move, not copy). You'll move them back afterwards.
Before you run the script, make sure you have a backup of your Pictures folder. I've tested the script, but I offer no guarantees
Next, open a terminal window (Applications/Other/Terminal). In it, type:
chmod +x rawdelete
ls -l rawdelete
and you should see something very similar to:
belukha:~ John$ chmod +x rawdelete
belukha:~ John$ ls -l rawdelete
-rwxr-xr-x 1 John wheel 172 20 Nov 14:06 rawdelete
(note that's ls -ell, not I or 1)
Now type:
cat rawdelete
You should see the seven lines of script as above displayed. If not, something has gone wrong with the copy/paste, so delete the file 'rawdelete' and create it again.
To run the script, type (note it starts with a full stop):
./rawdelete
You'll see a number of messages saying 'no such file or directory'. This is where you have a jpg but no matching raw file.
You will not find any deleted files in your trash: they will just be gone.
When it's finished, check all is OK and the move the folders back from Pictures/cleanup to Pictures.
Please ask if anything is unclear.