Skip to content

Instantly share code, notes, and snippets.

@koenongena
Created May 27, 2013 07:50
Show Gist options
  • Save koenongena/5655702 to your computer and use it in GitHub Desktop.
Save koenongena/5655702 to your computer and use it in GitHub Desktop.
Rename build.gradle files to ${projectName}.gradle
import static groovy.io.FileType.*
import static groovy.io.FileVisitResult.*
def currentFolder = new File(".")
def handleBuildFile = {File it ->
def folderName = it.parentFile.getName()
if (folderName != '.'){
it.renameTo(new File(it.getParentFile(), "${folderName}.gradle"))
}
}
currentFolder.traverse (
type: FILES, nameFilter: ~/build\.gradle$/, visit: handleBuildFile
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment