Not tested this but I think it should work in python (poss with some tweaking):
[Edit – ah bugger doesn’t like my leading spaces… lets try again…]
Obviously test thoroughly on dummy data or a copy of a folder before trying for real!
import glob # PROVIDES A NEAT WAY TO HANDLE FOLDERS OF FILES
import os # NEEDED TO DELETE FILES
import exiv2 # PROVIDES AN EASY WAY TO ACCESS THE EXIF DATA
for filename in glob.glob("*.jpg"): # CHANGE TO SUIT
~~~~filenameRaw, oldExtn = os.path.splitext(filename)+".raw" # creates filename with new extn
~~~~metadata = pyexiv2.ImageMetadata(filename)
~~~~metadata.read()
~~~~exifStars = metadata['Rating'] # COULD BE 'Exif.Image.Rating' ?
~~~~if exifStars==0 :
~~~~~~~~os.remove(filename)
~~~~~~~~os.remove(filenameRaw)
~~~~elif exifStarts<4 :
~~~~~~~~os.remove(filenameRaw)
OK it doesn’t like leading spaced in the code – so you need to replace all the ~ with a space.