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);
	 }
}

Leave a Comment

(required)

(required)

Formatting Your Comment

The following XHTML tags are available for use:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

URLs are automatically converted to hyperlinks.