def sourceFolder = 'D:\\Heroes'
new File(sourceFolder).eachFile {
def p = /[hH](eroes)\.S?0?(\d)E?(\d\d?).*/
if ( it.getName() ==~ p ) {
def s = (it.getName() =~ p).replaceFirst('H$1.S0$2E$3.avi')
println "${it.getName()}\n${it.getParent().toString()}\\${s}\n"
assert it.renameTo(new File("${it.getParent().toString()}\\${s}"))
}
}
Labels: Groovy
Why kopi house? The word kopi means coffee in our dialect and since Java symbolic icon is a cup of coffee, so this is why I named my blog as kopi house (Java with local favour) ; )
Subscribe to
Posts [Atom]