I think this button/script will do what you're after.
See the last part of How to add buttons from this forum to your toolbars for how to drag a .dcf file to create a button on your toolbar:
Test VBScript.dcf (2.31 KB)
Here is what the VBScript in the button looks like, for reference. (You don't need to copy & paste this anywhere; it is all in the .dcf file above.)
[code]
rawExt = ".raw"
Function OnClick(ByRef clickData)
Set cmd = clickData.func.command
Set fsu = DOpus.FSUtil
Set filesToDelete = DOpus.Create.StringSetI
For Each Item In clickData.func.sourcetab.selected_files
filesToDelete.insert(item.realpath)
If (LCase(Item.ext) = ".jpg") Then
Set altItemPath = fsu.NewPath(item.realpath)
altItemPath.ext = rawExt
If (fsu.Exists(altItemPath)) Then
filesToDelete.insert altItemPath
End If
ElseIf (LCase(Item.ext) = LCase(rawExt)) Then
Set altItemPath = fsu.NewPath(item.realpath)
altItemPath.ext = ".jpg"
If (fsu.Exists(altItemPath)) Then
filesToDelete.insert altItemPath
End If
End If
Next
If (Not filesToDelete.Empty) Then
cmd.ClearFiles
For Each filePath In filesToDelete
cmd.AddFile filePath
Next
' cmd.RunCommand "Delete"
cmd.RunCommand "Select FROMSCRIPT"
End If
End Function[/code]
After creating the button, edit it and you should see similar code.
You'll want to edit the top line of the script (rawExt = ".raw") to set the raw extension you're using. I've used ".raw" but it will probably be different, depending on the type of camera.
Also note the cmd.RunCommand lines near the bottom. As it comes, the script will only select the files, so you can test that it is doing what you expect it to do, before doing anything destructive with it. Please test that, in case I have misunderstood your requirements!
If you comment out the cmd.RunCommand "Select FROMSCRIPT" line (add a single quote ' to the start) and un-comment the cmd.RunCommand "Delete" line above it (remove the ' from the start), the script will then delete the files it was previously selecting.
The behavior of the script should be to select/delete all selected files, and to also select/delete any .jpg/.raw partner of any .jpr/.raw file that was initially selected.