Find

Description

Searches in a given path for a file and returns the absolute to it as property. If delimiter is set this task returns all found locations.

Parameters

Attribute Description Required
file The name of the file to search. yes
location The name of the property where to store the location yes
delimiter A delimiter to use when returning the list only if the list is required

Parameters specified as nested elements

path

The path where to search the file.

Examples

    <find file="ant.jar" location="loc">
        <path>
            <fileset dir="${ant.home}"/>
        <path>
    </find>
Searches in Ant home directory for a file ant.jar and stores its location in property loc (should be ANT_HOME/bin/ant.jar).
    <find file="ant.jar" location="loc" delimiter=";">
        <path>
            <fileset dir="C:/"/>
        <path>
    </find>
    <echo>ant.jar found in: ${loc}</echo>
Searches in Windows C: drive for all ant.jar and stores their locations in property loc delimited with ;. (should need a long time :-) After that it prints out the result (e.g. C:/ant-1.5.4/bin/ant.jar;C:/ant-1.6/bin/ant.jar).