Groovy: remove unexpected duplications of images

GroovyConsole with my code


Today i realised that in one of my photo album (“D:/Entertainment/photos/2010/20100814″) there are many duplications (one for each file).
It looked like here:

_MG_9884.CR2
_MG_9884.xmp
_MG_9884-1.CR2
_MG_9884-1.xmp

I thought it’s time for groovyConsole :-)
Solution was incredibly simple and intuitive:

new File("D:/Entertainment/photos/2010/20100814")
    .eachFileMatch(~/(.*?)-1\.(CR2|xmp)/){ file ->
        println file.name
        file.delete();
    }