ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <>
Subject Re: Another options
Date Mon, 10 Aug 2009 15:06:35 GMT
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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message