Skip to content

Instantly share code, notes, and snippets.

@meoyawn
Created October 15, 2014 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meoyawn/7e0ec7cfb9dc6b40a04c to your computer and use it in GitHub Desktop.
Save meoyawn/7e0ec7cfb9dc6b40a04c to your computer and use it in GitHub Desktop.
gradle script that sorts *@*dpi.png files into *dpi folders
final tree = fileTree("./assets").include('**/*@*dpi.png')
String normalize(String src) {
return src.replaceAll(/ /, "_")
}
tree.each { f ->
final m = f.name =~ /(.*)@(.*dpi)\.png/
final name = m[0][1]
final density = m[0][2]
mkdir("./assets/$density")
f.renameTo(new File("./assets/$density", "${normalize(name)}.png"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment