ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Redondo Gallardo, Raul Maria" <>
Subject RE: Another options
Date Tue, 11 Aug 2009 06:19:03 GMT
Thank you very much, David,

This is exactly which I need, but... Is it possible to split each record of the fileset and
do something with it? I'm new with ANT and I think I want to do things quite advanced.

I've got:

<project name="fileset_run" basedir=".">

<target name="filev2.test">
    <condition property="file.found">
        <resourcecount when="ge" count="1">
            <fileset dir="D:\folder1\folder_run id="fileid">
		<include name="**/fileV2.txt"/>

<target name=""
 	<echo> ${toString:fileid} </echo>



And it shows a list like: 

Is it possible to split the output and do things for each result?
Is it possible to obtain only the path of each of them to use it to move inside folders?

Thank you very very much.

Best regards,


-----Mensaje original-----
De: David Weintraub [] 
Enviado el: lunes, 10 de agosto de 2009 17:07
Para: Ant Users List
Asunto: Re: Another options

On Mon, Aug 10, 2009 at 2:51 AM, Redondo Gallardo, Raul Maria <> wrote:

> I need to check a folder structure and if in a folder found a certain file,
> do several things. Is the best way to do this to use a fileset or exist
> another better option?
> With the fileset.... I'm locked. :S:S

Here's a simple way with the condition task:

<target name="file.test">
    <condition property="file.found">
        <resourcecount when="ge" count="1">
            <fileset dir="${}">
                <include name="${}"/>

<target name=""
    <blah, blah, blah>

You execute target "". This runs the target "file.test". The
condition will set the property "file.found" if the file ${} exists
in the directory ${}. If the property "file.test" is set, the
target "" will execute. Otherwise, that target will be skipped.

What's nice about this is that it doesn't require any other resources except
for the standard Ant resources. However, you must be using Ant 1.7 or

David Weintraub

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message