Created
March 19, 2016 18:12
-
-
Save phase/52d73369b72968650966 to your computer and use it in GitHub Desktop.
Groovy Script to rename a bunch of images by number
This file contains 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
int count = 1 | |
new File("C:/Users/phase/Pictures/FloridaVisits").eachFile() { file -> | |
if(file.getName().endsWith(".jpg")) { | |
String absolutePath = file.getAbsolutePath() | |
String filePath = absolutePath.substring(0,absolutePath.lastIndexOf(File.separator)) | |
println file.getAbsolutePath() + " -> " + filePath+"\\"+count+".jpg" | |
file.renameTo(new File(filePath+"\\"+count+++".jpg")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment