Created
October 15, 2014 08:59
-
-
Save meoyawn/7e0ec7cfb9dc6b40a04c to your computer and use it in GitHub Desktop.
gradle script that sorts *@*dpi.png files into *dpi folders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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