Find and Delete Partial-Named "Duplicate" Files

Hi,

I've got a bit of a tricky request here; wondering if it would be possible to create a button script to find/select and delete "duplicate" filenames not based on the entire filename, but just part of the filename.

Background: I keep my iPhone apps stored on a USB drive. When there are app updates, I copy from my local drive to the USB drive; however, I want to automate the deletion of the obsolete files on the USB drive.

For example, after updating and copying from my local to my USB drive, I could have the following on my USB drive:
[ul]
[li]App1 1.0.5[/li]
[li]App1 1.2[/li]
[li]App2 5.2.6[/li]
[li]App3 1.8.2[/li]
[li]App4 2.7.0[/li]
[li]App4 3.0[/li]
[li]App5 1.0.1[/li]
[li]App5 1.0.2[/li]
[li]App6 2.7.1[/li][/ul]
From the above, only App1, App4, and App5 are what I consider "partial-name" duplicates. By partial-name, I mean just the name and not version number that's part of the name; therefore, I consider "App1 1.05" and "App1 1.2" to be "duplicates."

The version number itself is not important and I'd rather not depend on using it due to the possible inconsistent formatting; therefore, of the two files that are identified as "duplicates," it would be safer to delete the older one.

Can this be done in a button/script? If so, can you provide some guidance because I have no clue on how to even begin to implement! :smiley:

Thanks!