intente esto… el substituto incluye para los incluya los archivos localización substituta para la localización del directorio en donde se copian los archivos
<project name="Raul" default="main" basedir="."> <target name="main"> <script language="javascript"> <![CDATA[ xmlfiles = new java.io.File(".").listFiles().findAll{ it =~ "\filev2.txt$"} var myDirectoryArray=new Array(); xmlfiles.sort().each { myDirectoryArray += it.toString().split(";"); } for (key in myDirectoryArray) { //start myKey setprop = projname.setProperty("fs.dir", myDirectoryArray(key)); // import statements // importPackage(java.io); importClass(java.io.File); // Access to Ant-Properties by their names dir = project.getProperty("fs.dir"); fs.includes="*.*"; //change this as necessary includes = MyProject.getProperty("fs.includes"); // Create a <fileset dir="" includes=""/> fs = project.createDataType("fileset"); fs.setDir( new File(dir) ); fs.setIncludes(includes); ds = fs.getDirectoryScanner(project); srcFiles = ds.getIncludedFiles(); importClass(java.io.File); Copy copy = (Copy)project.createTask("copy"); copy.setTodir(basedir); copy.addFileset(fs); copy.init(); copy.setLocation(location); copy.execute(); } //end myKey in DirectoryArray </script> </target> </project> Saludos Cordiales desde EEUU Martin Gainty ______________________________________________ Note de déni et de confidentialité Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Subject: RE: Another options > Date: Tue, 11 Aug 2009 16:20:59 +0200 > From: rmredo...@eservicios.indra.es > To: user@ant.apache.org > > Well, I'll try it: > > For example: In a main folder C: with different subfolders structure I need > to find the folder(s) which contain the file with name filev2.txt. After I > must to copy all the files of this directory to another folder and launch a > java program from ANT. Is this possible?. > > For example: > > It exist the structure of folders: > C:\home\folder01\file.txt > C:\home\folder01\file2.txt > C:\Work\folder10\folder20\fileA.txt > C:\Work\folder10\folder20\fileB.txt > C:\Work\folder10\folder20\fileC.txt > C:\Work\folder10\folder20\filev2.txt > C:\Mom\folder40\folder50\fileA.txt > C:\Mom\folder40\folder50\fileB.txt > C:\Mom\folder40\folder50\filev2.txt > C:\happy\file.txt > > I must to find in C: the folders which contains the file filev2.txt and copy > the files into the same folder to another path and launch a java program. > > When I use fileset, I obtain: > C:\Work\folder10\folder20\filev2.txt; C:\Mom\folder40\folder50\filev2.txt > > With this I would want to do: > 1.- Split the line in two (C:\Work\folder10\folder20\filev2.txt and > C:\Mom\folder40\folder50\filev2.txt) > > 2.- Obtain the path of the first substring (C:\Work\folder10\folder20) > > 3.- Copy the all the files which exists into this folder to D:\process > > 4.- Launch a file .bat that works with this files > > > These are the four steps which I need, the step number 4 I have solved, but > the steps 1, 2 and 3, I've no idea if is it possible to do with ANT. > > > > Do you understand the example? Is it possible to do this? > > Thank you very very much. > > Best regards. > > PS: If you think that exist an easy way to do this, tell me, because the > steps are not fixed, they are the way which I think would be a solution, but > it's possible that I'm wrong. > > Thank you very much again. > > Raúl > > > > > -----Mensaje original----- > De: Francis GALIEGUE [mailto:f...@one2team.com] > Enviado el: martes, 11 de agosto de 2009 15:57 > Para: Ant Users List > Asunto: Re: Another options > > On Tue, Aug 11, 2009 at 10:00, Redondo Gallardo, Raul > Maria<rmredo...@eservicios.indra.es> wrote: > > Hello Francis, > > > > Yes, you are right, but my problem (may be I'm express wrong) is that I > > don't know exactly the structure folder and in spite of use de dirset > > option, I get the searched folders with a Fileset and I want to split the > > result and extract the path to move across the folders. > > > > I've looking for about this and I don't found anything and the tests which > > I've done don't get it. > > > > Thank you very much and sorry. > > > > Can you give an example? > > -- > > Francis Galiegue > ONE2TEAM > Ingénieur système > Mob : +33 (0) 683 877 875 > Tel : +33 (0) 178 945 552 > f...@one2team.com > 40 avenue Raymond Poincaré > 75116 Paris > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > _________________________________________________________________ Get your vacation photos on your phone! http://windowsliveformobile.com/en-us/photos/default.aspx?&OCID=0809TL-HM