Groovy: remove unexpected duplications of images
Filed in Coding, 27/10/2010, 07:16 by parhelium
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();
}
Scala – save file to disk
Filed in Coding, 21/01/2010, 14:48 by parhelium
var path:String = new File("./").getCanonicalPath+"/"
var file:String = path+"fileName.txt"
val writer = new PrintWriter( BufferedWriter(new FileWriter(file,false)));
writer.print(temp+" ")
writer.println("")
writer.close()