Copiando con ant

casiano@exthost:~/src/groovy/files$ cat antcopy.groovy
#!/usr/bin/env groovy
def ant = new AntBuilder()
ant.copy(file: args[0], tofile: args[1])

casiano@exthost:~/src/groovy/files$ ./antcopy.groovy antcopy.groovy antcopy2.groovy
     [copy] Copying 1 file to /home/casiano/src/groovy/files
casiano@exthost:~/src/groovy/files$ diff antcopy.groovy antcopy2.groovy
casiano@exthost:~/src/groovy/files$ 
casiano@exthost:~/src/groovy/files$ echo $?
0

casiano@exthost:~/src/groovy/files$ cat -n build.xml
     1  <project name="test" basedir=".">
     2    <target name="copy">
     3      <copy file="antcopy.groovy" tofile="antcopy2.groovy" />
     4    </target>
     5  </project>

casiano@exthost:~/src/groovy/files$ ant copy
Buildfile: build.xml

copy:

BUILD SUCCESSFUL
Total time: 0 seconds
casiano@exthost:~/src/groovy/files$ ls -ltr antcopy*.groovy
-rwxr-xr-x 1 casiano Profesor 90 2010-04-21 15:10 antcopy.groovy
-rwxr--r-- 1 casiano Profesor 90 2010-04-21 15:11 antcopy2.groovy
casiano@exthost:~/src/groovy/files$

casiano@exthost:~/src/groovy/files$ cat ./antcopy.groovy
#!/usr/bin/env groovy
def ant = new AntBuilder()
//ant.copy(file: args[0], tofile: args[1])
ant.copy(file: args[0], tofile: args[1], overwrite: true)

casiano@exthost:~/src/groovy/files$ ./antcopy.groovy build.xml antcopy2.groovy
     [copy] Copying 1 file to /home/casiano/src/groovy/files
casiano@exthost:~/src/groovy/files$ diff build.xml antcopy2.groovy
casiano@exthost:~/src/groovy/files$ echo $?
0



Casiano Rodríguez León
2010-04-30