Imagine I have two files of the same type (e.g. mp3), each with different content and named differently. Sometimes I'd like to be able to overwrite file A with file B, but preserve the filename of A.

The most common scenario where this happens is with my mp3s in iTunes. For example, I'll have a song in my library at 128kbps called 'mySong.mp3'. Later I'll re-rip the song from the CD at 192kbps, but for whatever reason the file is named differently, e.g. 'mySongBetterQuality.mp3'.

I don't want to delete the original song and then reimport the better quality mp3, because I'll lose all my metadata (play count, lyrics, etc). Instead I trick iTunes by renaming 'mySongBetterQuality.mp3' to 'mySong.mp3' and then copying it into the directory where the old song is located, thus overwriting the old song. The next time I open the song in iTunes, it recognises the new kbps, but sees it as the same song in all other respects, so my metadata is preserved.

This is a nice little hack to use every now and then, but when you've reimported a whole album you have possibly 12 files to rename - it's rather tedious. So basically I'm trying to locate/create a better way of doing this.

One slightly quicker method is to use the 'cp' command in Terminal. I start off by typing 'cp ' at the prompt. I then drag and drop the source file into the terminal window, which results in the full filename being typed out for me. Next I type a space, then I drag the destination file into the Terminal. I end up with something like this:

> cp /Users/me/here/mySong.mp3 Users/me/there/mySongBetterQuality.mp3

The cool thing about cp is that if the destination filename already exists, it will simply overwrite it, which is exactly what I want.

Again, this is a nice little hack to use, but it's a bit tedious. What I *really* want is some kind of drag and drop method that has the same result. For example, I right-click and drag file B, drop it over file A, and I'm presented with an Overwrite option in the context menu.

Does anyone know how I could go about creating this? Could Automator help?