Thank you very much /muchas gracias, Francis and Martin

I've trying the option of Francis but Appear and error and I can't find what is 
the reason.

When I try to run the application sais that there is a  problem with the for 
command, exactly sais: "failed to create task or type for". I've been looking 
for the problem and don't find many data about "for with dirset, but the link 
which I've found, seems to stay in the same way which I've done.

My code is the next. Where is the problem, seems to be right:


<?xml version="1.0"?>
<project name="fileset_run" basedir=".">


<macrodef name="domystuff">
    <attribute name="directory"/>
    <sequential>
        <copy todir="D:\process">
            <fileset dir="D:\Ejecutables" id="fileid">
                <include name="**\argsV2.txt"/>
            </fileset>
        </copy>
        <exec executable="d:\process\the.bat"/>
        <delete>
            <fileset dir="D:\process" includes="*"/>
        </delete>
    </sequential>
</macrodef>

<target name="doit">
    <for param="direct">
        <dirset dir="D:\Ejecutables" includes="**\*"/>
        <sequential>
            <if>
                <available file="@{direct}\argsv2.txt" type="file"/>
                <then>
                    <domystuff directory="@{direc}"/>
                </then>
            </if>
        </sequential>
    </for>
</target>

</project>


Thank you very very much.

Raúl

-----Mensaje original-----
De: Martin Gainty [mailto:mgai...@hotmail.com] 
Enviado el: martes, 11 de agosto de 2009 21:49
Para: Ant Users List
Asunto: RE: Another options


parce que je suis plus courant sur Java ou Javascript j'ai codé une solution 
dans JS. 

Ce que vous avez fourni est une solution bien meilleure pour la fourmi build.xml

Merci Monsieur Galiegue!

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.




> Date: Tue, 11 Aug 2009 20:57:35 +0200
> Subject: Re: Another options
> From: f...@one2team.com
> To: user@ant.apache.org
> 
> On Tue, Aug 11, 2009 at 16:20, Redondo Gallardo, Raul
> Maria<rmredo...@eservicios.indra.es> wrote:
> > 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.
> >
> 
> It is possible, either with or without the split. Here is a solution
> without the split, which makes use of ant-contrib (yes, I just cannot
> work without it, it's too powerful to be ignored imho). Of course,
> you'll have to adapt it to what your script expects as an argument,
> whether the build should fail if the script fails, etc (and note that
> ant-contrib also has try/catch).
> 
> Note that while <dirname> looks great, it has a huge drawback: its
> output is a property, and properties are immutable. At least, they're
> immutable with ant 1.6.x, I don't know for ant 1.7.x.
> 
> <macrodef name="domystuff">
>     <attribute name="directory"/>
>     <sequential>
>         <copy todir="D:\process">
>             <fileset dir="@{directory}" includes="*"/>
>         </copy>
>         <exec executable="C:\path\to\the.bat"/>
>         <delete>
>             <fileset dir="D:\process" includes="*"/>
>         </delete>
>     </sequential>
> </macrodef>
> 
> <target name="doit">
>     <for param="directory">
>         <dirset dir="c:" includes="**/*"/>
>         <sequential>
>             <if>
>                 <available file="@{directory}.filev2.txt" type="file"/>
>                 <then>
>                     <domystuff directory="@{directory}"/>
>                 </then>
>             </if>
>         </sequential>
>     </for>
> </target>
> 
> -- 
> 
> 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
> 

_________________________________________________________________
Express your personality in color! Preview and select themes for Hotmail®. 
http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=PID23391::T:WLMTAGL:ON:WL:en-US:WM_HYGN_express:082009

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to