Gradle: Copy dir with ant and groovy
Simple gradle task written in groovy which copy one dir into another and list all files matched by extension.
Inside task you can find one tiny example of formating date in Groovy. Seems to be obvious, but wasn’t for me…
task deploy << {
def today = new Date().format("dd-MM-yyyy");
def srcPath= "G:/projects/job/2011/PROJECT_NAME/fb-bin"
def desPath = "X:/My Dropbox/Public/PROJECT_NAME/"+today
println "date: " + today;
ant.copy(todir: desPath) {
fileset(dir : srcPath )
}
new File(desPath).listFiles(
[accept:{file-> file ==~ /.*?\.swf/ }] as FileFilter
).toList()
.each{
f -> println "$f,"+ Math.floor(f.size()/1024);
}
}