def ant = new AntBuilder() ant.get(src: 'http://groovy.codehaus.org/a.jpg', dest: /C:\scrap\a.jpg/, skipexisting: 'true') //or File destFile = new File(dest) if (destFile.exists()) return destFile.withOutputStream { it << src.toURL().openStream() }