Utilizando AntBuilder para Copiar un Directorio

casiano@exthost:~/src/groovy$ cat files/copydir.groovy
#!/usr/bin/env groovy

def ant = new AntBuilder()
ant.copy(todir: args[1]) {
 fileset(dir: args[0])
}

casiano@exthost:~/src/groovy$ files/copydir.groovy files/ backup/
     [copy] Copying 38 files to /home/casiano/src/groovy/backup
casiano@exthost:~/src/groovy$ diff -r files backup
Sólo en files: .svn
casiano@exthost:~/src/groovy$ echo $?
1

casiano@exthost:~/src/groovy$ cat build.xml
<project name="test" basedir=".">
  <target name="backup">
    <copy todir="backup">
      <fileset dir="files" />
    </copy>
  </target>
</project>

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

backup:
     [copy] Copying 38 files to /home/casiano/src/groovy/backup

BUILD SUCCESSFUL
Total time: 0 seconds

casiano@exthost:~/src/groovy$ ls -ltrd */ | tail -1
drwxr-xr-x 2 casiano Profesor 0 2010-04-21 15:45 backup/
casiano@exthost:~/src/groovy$ diff -r files backup/
Sólo en files: .svn



Subsecciones

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