I'm fairly certain this can be done (simply), but it's been years since I wrote a batch file, and I'm scared I'll screw things up and end up deleting all the files on my HD

Here's what I'm trying to accomplish.

I have a directory of audio files (.mp3), and a program I use writes a plot file for each audio file (it's an .mxm file).

When you rename an audio file, it will create a new .mxm file, but it leaves behind the old .mxm file. The orphaned .mxm is no longer needed and in fact kinda makes a mess things.

I'm trying to find a simple batch file (or even a shareware program) that will:

1. Look at all the files within a directory that have an extension of .mxm

2. See if, within that directory, there is a matching .mp3 file (where the filename of the .mp3 is the exact same filename of the .mxm file)

3. If there is a matching .mp3 to the .mxm, then go to the next .mxm file and look for a .mp3, etc ...

4. If there is NO matching .mp3 to the .mxm, then delete the unneeded .mxm file then move to the next .mxm for a comparison.

5. Hopefully have the batch file end once all the .mxm files are compared (but if it starts at the top of the directory again and runs in a continuous loop, I can always stop that manually.

6. I've tried using this code with no luck. I think it's because these are long file names, not DOS 8.3 file names.

@ echo off
for %%f in (*.mxm) do if not exist %%~nf.mp3 del %%f

I certainly don't mind if someone wants to give me some instructions as to how to go about writing such a batch file. I'll be glad to do it. But I figure it will probably be easier and quicker for someone to throw together a quickie batch file and just be done with it.

Either way, I sure appreciate anyone's help.

Thanks