There are multiple files in a directory that begin with prefix fgh, for example:
fgh
fghfilea fghfileb fghfilec
I want to rename a
Here's a way to do it using command-line Groovy:
groovy -e 'new File(".").eachFileMatch(~/fgh.*/) {it.renameTo(it.name.replaceFirst("fgh", "jkl"))}'